Index: /trunk/src/civ.m
===================================================================
--- /trunk/src/civ.m	(revision 162)
+++ /trunk/src/civ.m	(revision 163)
@@ -1861,5 +1861,5 @@
             cmd=[cmd '#$ -cwd \n'];
             cmd=[cmd 'hostname && date \n'];
-            cmd=[cmd 'umask 002 \n'];
+            cmd=[cmd 'umask 002 \n'];%allow writting access for user group for created files
         end
         if civAll
@@ -1964,8 +1964,14 @@
             end
             if isequal(civAll,0)
+                if isunix %unix system
                 cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(flagindex1(1)) ...
                     ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ...
                     ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName ' maskname];
-                cmd_FIX=regexprep(cmd_FIX,'\\','\\\\');
+                else %windows system
+                    cmd_FIX=['"' sparam.FixBin '" -f "' filecell.nc.civ1{ifile,j} '" -fi1 ' num2str(flagindex1(1)) ...
+                    ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ...
+                    ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName "' maskname '"'];
+                    cmd_FIX=regexprep(cmd_FIX,'\\','\\\\');
+                end
                 cmd=[cmd cmd_FIX '\n'];
             else
@@ -1993,5 +1999,4 @@
             if isequal(civAll,0)
                 cmd_PATCH=PATCH_CMD(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp,sparam.PatchBin);
-                cmd_PATCH=regexprep(cmd_PATCH,'\\','\\\\');
                 cmd=[cmd cmd_PATCH '\n'];
             else
@@ -2109,5 +2114,5 @@
                 else
                     filename_cmx=regexprep(filename_cmx,'\\','\\\\');
-                    cmd=[cmd 'copy /Y ' filename_cmx '2 ' filename_cmx '\n' cmd_CIV2 '\n'];
+                    cmd=[cmd 'copy /Y "' filename_cmx '2" "' filename_cmx '"\n' cmd_CIV2 '\n'];
                 end
             else
@@ -2139,8 +2144,14 @@
             end
             if isequal(civAll,0)
+                if isunix
                 cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ2{ifile,j} ' -fi1 ' num2str(flagindex2(1)) ...
                     ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ...
                     ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname];
-                cmd_FIX=regexprep(cmd_FIX,'\\','\\\\');
+                else
+                    cmd_FIX=['"' sparam.FixBin '" -f "' filecell.nc.civ2{ifile,j} '" -fi1 ' num2str(flagindex2(1)) ...
+                    ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ...
+                    ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName "' maskname '"'];
+                    cmd_FIX=regexprep(cmd_FIX,'\\','\\\\');
+                end
                 cmd=[cmd cmd_FIX '\n'];
             else
@@ -2168,5 +2179,4 @@
             if isequal(civAll,0)
                 cmd_PATCH=PATCH_CMD(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp,sparam.PatchBin);
-                cmd_PATCH=regexprep(cmd_PATCH,'\\','\\\\');
                 cmd=[cmd cmd_PATCH '\n'];
             else
@@ -2240,5 +2250,5 @@
                 % cmd_str=['!at -qb now -f ' filename_bat ' &']; %ou at -qb now -f bad idea...
             else %case of Windows
-                cmd_str=['@call ' regexprep(filename_bat,'\\','\\\\')];
+                cmd_str=['@call "' regexprep(filename_bat,'\\','\\\\') '"'];
             end
             super_cmd=[super_cmd cmd_str '\n'];         
@@ -2524,5 +2534,5 @@
                 filecell={};
                 return
-            else          
+            elseif isunix          
                 [xx,msg2] = fileattrib(subdir_civ1_new,'+w','g'); %yield writing access (+w) to user group (g)
                 if ~strcmp(msg2,'')
@@ -3011,11 +3021,16 @@
 namelog=[filename_nc([1:end-3]) '_patch.log'];
 if test_interp==0
+    if isunix
     cmd_PATCH=[PatchBin ' -f ' filename_nc ' -m ' nx_patch  ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ...
         '  > ' namelog ' 2>&1']; % redirect standard output to the log file
+    else
+      cmd_PATCH=['"' PatchBin '" -f "' filename_nc '" -m ' nx_patch  ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ...
+        '  > "' namelog '" 2>&1']; % redirect standard output to the log file
+    end
 else %nouveau programme patch
     cmd_PATCH=[PatchBin ' -f ' filename_nc ' -m ' nx_patch  ' -n ' ny_patch ' -ro ' rho_patch ...
         ' -max ' thresh_value ' -nopt ' subdomain_patch  '  > ' namelog ' 2>&1']; % redirect standard output to the log file
 end
-
+cmd_PATCH=regexprep(cmd_PATCH,'\\','\\\\');
 %------------------------------------------------------------------------
 % --- STEREO Interp
@@ -4032,37 +4047,4 @@
     par.Dt='1' ;%case of 'displacement' mode
 end
-%
-%     textcmx={'##############   CMX file';...
-%     ['FirstImage ' par.filename_ima_a];...
-%     ['LastImage  ' par.filename_ima_b];...
-%     'XX' ;...
-%     ['Mask ' par.maskflag] ;...
-%     ['MaskName ' par.maskname];...
-%     ['ImageSize ' par.npx ' ' par.npy];...   %VERIFIER CAS GENERAL ?
-%     ['CorrelationBoxesSize ' par.ibx ' ' par.iby];...
-%     ['SearchBoxeSize ' par.isx ' ' par.isy];...
-%     ['RO ' par.rho];...
-%     ['GridSpacing ' par.dx ' ' par.dy];...
-%     'XX 1.0';...
-%     ['Dt_TO ' par.Dt ' ' par.T0];...
-%     ['PixCmXY ' par.pxcmx ' ' par.pxcmy];...
-%     'XX 1';...
-%     ['ShiftXY ' par.shiftx ' '  par.shifty];...
-%     ['Grid ' par.gridflag];...
-%     ['GridName ' par.gridname] ;...
-%     'XX 85';...
-%     'XX 1.0';...
-%     'XX 1.0';...
-%     'Hart 1';...
-%     'DecimalShift 0';...
-%     'Deformation 0';...
-%     'CorrelationMin 0';...
-%     'IntensityMin 0';...
-%     'SeuilImage n';...
-%     'SeuilImageValues 0 4096';...
-%     ['ImageToUse ' par.term_a ' ' par.term_b];... % VERIFIER ?
-%     'ImageUsedBefore null null'};
-%
-%             textout=char(textcmx);
 par.filename_ima_a=regexprep(par.filename_ima_a,'.png','');
 par.filename_ima_b=regexprep(par.filename_ima_b,'.png','');
@@ -4100,14 +4082,17 @@
 fclose(fid);
 
-cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file
-cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\');
-namelog=regexprep(namelog,'\\','\\\\');
-
+% cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file
+% cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\');
+% namelog=regexprep(namelog,'\\','\\\\');
 if(isunix)
     [Rootbat,Filebat,extbat]=fileparts(namelog);
     ncName=fullfile(Rootbat,[ Filebat '.nc']);
+    cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file
     cmd_CIV1=[cmd_CIV1 '\n' 'mv ' namelog  ' ' regexprep(namelog,'\.log','') '.civ1.log' '\n' 'chmod g+w ' ncName];
-else
-    cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y ' namelog ' ' regexprep(namelog,'\.log','') '.civ1.log'];
+else %Windows system
+    cmd_CIV1=['"' sparam.Civ1Bin '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
+    cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\');
+    namelog=regexprep(namelog,'\\','\\\\');
+    cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' namelog '" "' regexprep(namelog,'\.log','') '.civ1.log"']; 
 end
 
@@ -4212,38 +4197,4 @@
     par.Dt='1' ;%case of 'displacement' mode
 end
-% textcmx=['##############   CMX file'  '\n'...
-% ['FirstImage ' par.filename_ima_a]  '\n'...
-% ['LastImage  ' par.filename_ima_b]  '\n'...
-% 'XX'   '\n'...
-% ['Mask ' par.maskflag]  '\n'...
-% ['MaskName ' par.maskname]  '\n'...
-% ['ImageSize ' par.npx ' ' par.npy]  '\n'...
-% ['CorrelationBoxesSize ' par.ibx ' ' par.iby]  '\n'...
-% ['SearchBoxeSize ' par.ibx ' ' par.iby]  '\n'...
-% ['RO ' par.rho]  '\n'...
-% ['GridSpacing ' par.dx ' ' par.dy]  '\n'...
-% 'XX 1.0'  '\n'...
-% ['Dt_TO ' par.Dt ' ' par.T0]  '\n'...
-% ['PixCmXY ' par.pxcmx ' ' par.pxcmy]  '\n'...
-% 'XX 1'  '\n'...
-% ['ShiftXY 0 0']  '\n'...
-% ['Grid ' par.gridflag]  '\n'...
-% ['GridName ' par.gridname]  '\n'...
-% 'XX 85'  '\n'...
-% 'XX 1.0'  '\n'...
-% 'XX 1.0'  '\n'...
-% 'Hart 1'  '\n'...
-% ['DecimalShift ' par.decimal]  '\n'...
-% ['Deformation ' par.deformation]  '\n'...
-% 'CorrelationMin 0'  '\n'...
-% 'IntensityMin 0'  '\n'...
-% 'SeuilImage n'  '\n'...
-% 'SeuilImageValues 0 4096'  '\n'...
-% ['ImageToUse ' par.term_a ' ' par.term_b]  '\n'... % VERIFIER ?
-% ['ImageUsedBefore ' par.filename_nc1]];
-% textout=char(textcmx);
-% fid=fopen([filename_cmx '2'],'w');
-% fprintf(fid,textout);
-% fclose(fid)
 
 par.filename_ima_a=regexprep(par.filename_ima_a,'.png','');
@@ -4282,14 +4233,14 @@
 fclose(fid);
 
-cmd_CIV2=[sparam.Civ2Bin ' -f ' filename  '.cmx >' filename '.log' ]; % redirect standard output to the log file
-cmd_CIV2=regexprep(cmd_CIV2,'\\','\\\\');
-namelog=regexprep(namelog,'\\','\\\\');
-
 if(isunix)
+    cmd_CIV2=[sparam.Civ2Bin ' -f ' filename  '.cmx >' filename '.log' ]; % redirect standard output to the log file
     [Rootbat,Filebat,extbat]=fileparts(namelog);
     ncName=fullfile(Rootbat,[ Filebat '.nc']);
     cmd_CIV2=[cmd_CIV2 '\n' 'mv ' namelog  ' ' regexprep(namelog,'\.log','') '.civ2.log' '\n' 'chmod g+w ' ncName];
-else
-    cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y ' namelog ' ' regexprep(namelog,'\.log','') '.civ2.log'];
+else 
+    cmd_CIV2=['"' sparam.Civ2Bin '" -f "' filename  '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
+    cmd_CIV2=regexprep(cmd_CIV2,'\\','\\\\');
+    namelog=regexprep(namelog,'\\','\\\\');
+    cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' namelog '" "' regexprep(namelog,'\.log','') '.civ2.log"'];
 end
 
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 162)
+++ /trunk/src/uvmat.m	(revision 163)
@@ -447,9 +447,9 @@
 %global filebase
 fileinput=[PathName FileName];%complete file name 
-testblank=findstr(fileinput,' ');%look for blanks
-if ~isempty(testblank)
-    msgbox_uvmat('ERROR',['The input file name ' fileinput ' contains blank character : This is not allowed. Please change name'])
-    return
-end
+% testblank=findstr(fileinput,' ');%look for blanks
+% if ~isempty(testblank)
+%     msgbox_uvmat('ERROR',['The input file name ' fileinput ' contains blank character : This is not allowed. Please change name'])
+%     return
+% end
 sizf=size(fileinput);
 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
@@ -986,9 +986,9 @@
         'Pick a file',RootPath);
 fileinput_1=[PathName FileName];%complete file name 
-testblank=findstr(fileinput_1,' ');%look for blanks
-if ~isempty(testblank)
-    msgbox_uvmat('ERROR',['The input file name ' fileinput_1 ' contains blank character : This is not allowed. Please change name'])
-    return
-end
+% testblank=findstr(fileinput_1,' ');%look for blanks
+% if ~isempty(testblank)
+%     msgbox_uvmat('ERROR',['The input file name ' fileinput_1 ' contains blank character : This is not allowed. Please change name'])
+%     return
+% end
 sizf=size(fileinput_1);
 if (~ischar(fileinput_1)||~isequal(sizf(1),1)),return;end
@@ -5017,9 +5017,9 @@
         'Pick an xml Object file',get(handles.RootPath,'String'));
 fileinput=[PathName FileName];%complete file name 
-testblank=findstr(fileinput,' ');%look for blanks
-if ~isempty(testblank)
-    msgbox_uvmat('ERROR','forbidden input file name: contain blanks')
-    return
-end
+% testblank=findstr(fileinput,' ');%look for blanks
+% if ~isempty(testblank)
+%     msgbox_uvmat('ERROR','forbidden input file name: contain blanks')
+%     return
+% end
 sizf=size(fileinput);
 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
