changeset 6210:12b676a0b183 before-graphics-branch

[project @ 2006-12-07 02:37:17 by jwe]
author jwe
date Thu, 07 Dec 2006 02:37:17 +0000
parents 15b299f6803d
children 778fd090e505
files scripts/ChangeLog scripts/miscellaneous/copyfile.m scripts/miscellaneous/movefile.m
diffstat 3 files changed, 27 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- 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  <michael.goffioul@swing.be>.
 
+	* 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  <hauberg@gmail.com>
--- 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).
--- 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