comparison scripts/miscellaneous/copyfile.m @ 11300:4ecc7bc5bc83

search PATH from environment for programs, not EXEC_PATH
author John W. Eaton <jwe@octave.org>
date Fri, 26 Nov 2010 02:58:16 -0500
parents 95c3e38098bf
children fd0a3ac60b0e
comparison
equal deleted inserted replaced
11299:6e8393b09d03 11300:4ecc7bc5bc83
38 msgid = ""; 38 msgid = "";
39 39
40 ## FIXME -- maybe use the same method as in ls to allow users control 40 ## FIXME -- maybe use the same method as in ls to allow users control
41 ## over the command that is executed. 41 ## over the command that is executed.
42 42
43 if (ispc () && ! isunix () && isempty (file_in_path (EXEC_PATH, "cp.exe"))) 43 if (ispc () && ! isunix ()
44 && isempty (file_in_path (getenv ("PATH"), "cp.exe")))
44 ## Windows. 45 ## Windows.
45 cmd = "cmd /C xcopy /E"; 46 cmd = "cmd /C xcopy /E";
46 cmd_force_flag = "/Y"; 47 cmd_force_flag = "/Y";
47 else 48 else
48 cmd = "cp -r"; 49 cmd = "cp -r";
91 max_cmd_line)) 92 max_cmd_line))
92 p1 = sprintf ("%s\"%s\" ", p1, f1{1}); 93 p1 = sprintf ("%s\"%s\" ", p1, f1{1});
93 f1(1) = []; 94 f1(1) = [];
94 endwhile 95 endwhile
95 96
96 if (ispc () && ! isunix () && ! isempty (file_in_path (EXEC_PATH, "cp.exe"))) 97 if (ispc () && ! isunix ()
98 && ! isempty (file_in_path (getenv ("PATH"), "cp.exe")))
97 p1 = strrep (p1, "\\", "/"); 99 p1 = strrep (p1, "\\", "/");
98 p2 = strrep (p2, "\\", "/"); 100 p2 = strrep (p2, "\\", "/");
99 endif 101 endif
100 102
101 ## Copy the files. 103 ## Copy the files.
105 msgid = "copyfile"; 107 msgid = "copyfile";
106 break; 108 break;
107 endif 109 endif
108 endwhile 110 endwhile
109 else 111 else
110 if (ispc () && ! isunix () && ! isempty (file_in_path (EXEC_PATH, "cp.exe"))) 112 if (ispc () && ! isunix ()
113 && ! isempty (file_in_path (getenv ("PATH"), "cp.exe")))
111 p1 = strrep (p1, "\\", "/"); 114 p1 = strrep (p1, "\\", "/");
112 p2 = strrep (p2, "\\", "/"); 115 p2 = strrep (p2, "\\", "/");
113 endif 116 endif
114 117
115 ## Copy the files. 118 ## Copy the files.