Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php
  2.  
  3. // Create Folder Assets on Resources in Your Project Laravel.
  4. $assets = __DIR__ . "/resources/assets";
  5. $public = __DIR__ . "/public/assets";
  6.  
  7. $system = php_uname("s");
  8.  
  9. if(preg_match("/Mac/mi", $system)){
  10. $system = "Mac";
  11. }elseif(preg_match("/(Linux|FreeBSD)/mi", $system)){
  12. $system = "Linux";
  13. }elseif(preg_match("/Windows/mi", $system)){
  14. $system = "Windows";
  15. }
  16.  
  17. switch($system){
  18. case "Mac":
  19. shell_exec("cp -RfXv {$assets} {$public}");
  20. echo "OK!";
  21. break;
  22. case "Linux":
  23. shell_exec("cp -rf {$assets} {$public}");
  24. echo "OK!";
  25. break;
  26. case "Windows":
  27. shell_exec("xcopy ".str_replace("/", "\\", $assets)." ".str_replace("/", "\\", $public)." /S /I /E /b /v /y");
  28. echo "OK!";
  29. break;
  30. default:
  31. echo "OS not supported!";
  32. break;
  33. }
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement