Changeset 24709
- Timestamp:
- 2011-10-03T15:48:21+13:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/file/FileAssociationManager.java
r24707 r24709 162 162 } 163 163 164 public String [] getCommand(File file) { 164 public String [] getCommand(File file) { 165 165 String command = null; 166 166 String [] commands = null; … … 218 218 } 219 219 220 if (command != null && !command.equals("")) { 220 if (command != null && !command.equals("")) { 221 221 222 // Make the command into a string [] 222 223 commands = command.split(" "); … … 228 229 // We have to fix filename under windows to escape the backslashes 229 230 filename = filename.replaceAll(ESCAPE, ESCAPED_ESCAPE); 231 232 // dealing with spaces in filepath when using start command 233 if(Utility.isWindows() && filename.indexOf(" ") != -1 && command.indexOf("start") != -1) { 234 // On Windows, start command used spaces in filepath. In this case: 235 // start and its arguments all together need to go into one element of the commands array 236 // otherwise <cmd /c start "window title" "%1"> does not work if there are spaces in the 237 // file path %1, when running the Process with a command array. 238 239 // Need <"start \"window\" \"%1\""> to be an element in the command array: 240 String[] tmp = commands; 241 int index = 0; 242 243 for(int i = 0; i < commands.length; i++) { 244 if(commands[i].indexOf("start") != -1) { 245 index = i; 246 } 247 } 248 249 commands = new String[index+1]; 250 for(int i = 0; i < index; i++) { 251 commands[i] = tmp[i]; 252 } 253 254 commands[index] = tmp[index]; 255 for(int i = index+1; i < tmp.length; i++) { 256 commands[index] = commands[index] + " " + tmp[i]; 257 } 258 259 } 230 260 231 261 for (int i=0; i<commands.length; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.