# HG changeset patch # User jwe # Date 1165459037 0 # Node ID 12b676a0b18395af2fa0ccceb516447d8be6ad03 # Parent 15b299f6803d23d1c676befcd2698aca9c2d34ad [project @ 2006-12-07 02:37:17 by jwe] diff -r 15b299f6803d -r 12b676a0b183 scripts/ChangeLog --- a/scripts/ChangeLog Thu Dec 07 01:20:04 2006 +0000 +++ b/scripts/ChangeLog Thu Dec 07 02:37:17 2006 +0000 @@ -1,5 +1,8 @@ 2006-12-06 Michael Goffioul . + * miscellaneous/copyfile.m, miscellaneous/movefile.m: + Work on Windows systems without cp or mv. + * startup/inputrc: Include sequences for Windows. 2006-12-06 Søren Hauberg diff -r 15b299f6803d -r 12b676a0b183 scripts/miscellaneous/copyfile.m --- a/scripts/miscellaneous/copyfile.m Thu Dec 07 01:20:04 2006 +0000 +++ b/scripts/miscellaneous/copyfile.m Thu Dec 07 02:37:17 2006 +0000 @@ -37,11 +37,20 @@ msg = ""; msgid = ""; + ## FIXME -- maybe use the same method as in ls to allow users control + ## over the command that is executed. + + if (ispc () && ! isunix () && isempty (file_in_path (EXEC_PATH, "cp"))) + cmd = "cmd /C xcopy /E"; + cmd_force_flag = "/Y"; + else + cmd = "cp -r"; + cmd_force_flag = "-f"; + endif + if (nargin == 2 || nargin == 3) if (nargin == 3 && strcmp (force, "f")) - cmd = "/bin/cp -rf"; - else - cmd = "/bin/cp -r"; + cmd = strcat (cmd, " ", cmd_force_flag); endif ## Allow cell input and protect the file name(s). diff -r 15b299f6803d -r 12b676a0b183 scripts/miscellaneous/movefile.m --- a/scripts/miscellaneous/movefile.m Thu Dec 07 01:20:04 2006 +0000 +++ b/scripts/miscellaneous/movefile.m Thu Dec 07 02:37:17 2006 +0000 @@ -36,11 +36,20 @@ msg = ""; msgid = ""; + ## FIXME -- maybe use the same method as in ls to allow users control + ## over the command that is executed. + + if (ispc () && ! isunix () && isempty (file_in_path (EXEC_PATH, "mv"))) + cmd = "cmd /C move"; + cmd_force_flag = "/Y"; + else + cmd = "mv"; + cmd_force_flag = "-f"; + endif + if (nargin == 2 || nargin == 3) if (nargin == 3 && strcmp (force, "f")) - cmd = "/bin/mv -f"; - else - cmd = "/bin/mv"; + cmd = strcat (cmd, " ", cmd_force_flag); endif ## Allow cell input and protect the file name(s). @@ -59,46 +68,4 @@ print_usage (); endif -### status = true; -### msg = ""; -### msgid = "movefile"; -### -### if (nargin == 2) -### -### flist = glob (f1); -### nfiles = numel (flist); -### if (nfiles > 1) -### [f2info, err, msg] = stat (f2); -### if (err < 0) -### status = false; -### else -### if (S_ISDIR (f2info.mode)) -### for i = 1:nfiles -### [err, msg] = rename (flist{i}, f2); -### if (err < 0) -### status = false; -### break; -### endif -### endfor -### else -### status = false; -### msg = "when moving multiple files, destination must be a directory"; -### endif -### endif -### else -### [err, msg] = rename (f1, f2); -### if (err < 0) -### status = false; -### break; -### endif -### endif -### -### else -### usage ("movefile (f1, f2)"); -### endif -### -### if (status) -### msgid = ""; -### endif - endfunction