changeset 317:6ee16aa4531c

Windows compatibility fix (For Michal Fita)
author adb014
date Mon, 07 Apr 2008 14:27:36 +0000
parents 7ad632356b13
children dd611d179dbf
files inst/imwrite.m
diffstat 1 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/inst/imwrite.m
+++ b/inst/imwrite.m
@@ -300,10 +300,18 @@
 otherwise
   error("imwrite: unsupported data type %s", class(data));
 endswitch
+
+if strcmp([computer](9:13), "msdos")
+  _null = "null:";
+  _apostroph = "\"";
+else
+  _null = "/dev/null";
+  _apostroph = "\"";
+endif
 
 if usepipe
-   pname= sprintf("convert %s %s:- '%s' 2>/dev/null",
-                  option_str, outputtype, fname);
+   pname= sprintf("convert %s %s:- %c%s%c 2> %s",
+                  option_str, outputtype, _apostroph, fname, _apostroph, _null);
    fid= popen(pname ,'w');
 
    if fid<0;
@@ -311,8 +319,8 @@
    end
 else
    tnam= tmpnam();
-   cmd= sprintf("convert %s '%s:%s' '%s' 2>/dev/null",
-                 option_str, outputtype, tnam, fname);
+   cmd= sprintf("convert %s %c%s:%s%c %c%s%c 2> %s",
+                 option_str, _apostroph, outputtype, tnam, _apostroph, _apostroph, fname, _apostroph, _null);
    fid= fopen(tnam, "wb");
 end   
 
@@ -341,7 +349,11 @@
 end_unwind_protect
 
 #
-# $Log$
+# $Log$
+# 
+# Patch 2008/03/25 20:42:00 Michal Fita
+# Compability with ImageMagick on Windows
+# 
 # Revision 1.3  2007/01/02 21:58:38  hauberg
 # Documentation is now in Texinfo (looks better on the website)
 #