Author: jfallows
Date: Thu Aug 25 20:26:02 2011
New Revision: 1161734

URL: http://svn.apache.org/viewvc?rev=1161734&view=rev
Log:
Handle both absolute and relative cases when detecting executables

Modified:
    
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java

Modified: 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java?rev=1161734&r1=1161733&r2=1161734&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java
 Thu Aug 25 20:26:02 2011
@@ -307,15 +307,21 @@ public final class PathUtil
             return null;
 
         File executableFile = new File(executable);
-        if (executableFile.exists())
-            return executableFile;
-
-        // handle case where executable is actually absolute
         if (executableFile.isAbsolute())
         {
+            // handle case where executable is absolute
             executablePath = executableFile.getParentFile();
             executable = executableFile.getName();
         }
+        else 
+        {
+            // handle case where executable is relative to executable path
+            executableFile = new File(executablePath, executable);
+        }
+
+        // determine if the executable exists (without an extension)
+        if (executableFile.exists())
+            return executableFile;
 
         // TODO: handle linux/mac ?
         String[] extensions = new String[] {"exe", "com", "bat", "cmd"};


Reply via email to