Changeset 2837


Ignore:
Timestamp:
05/30/07 17:17:11 (13 years ago)
Author:
sorber
Message:

Added method to format paths passed to Runtime.exec()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/overlays/SpreadsheetLauncher.java

    r2835 r2837  
    9090  { 
    9191    if (file.exists()) { 
    92       String command = appPath + " " + file.getAbsolutePath(); 
     92      String command = formatPath(appPath) + " " + 
     93        formatPath(file.getAbsolutePath()); 
     94 
    9395      try { 
    9496        Runtime.getRuntime().exec(command); 
     
    104106 
    105107  // -- Helper methods -- 
     108 
     109  /** Formats path to avoid problems caused by embedded spaces. */ 
     110  protected String formatPath(String plainPath) { 
     111    String formattedPath = plainPath; 
     112    if (isWindows()) formattedPath = "\"" + formattedPath + "\""; 
     113    return formattedPath; 
     114  } 
    106115 
    107116  /** Whether the OS is windows. */ 
Note: See TracChangeset for help on using the changeset viewer.