Author: brett
Date: Tue Dec 20 06:23:52 2011
New Revision: 1221116

URL: http://svn.apache.org/viewvc?rev=1221116&view=rev
Log:
use home directory if Program Files can't be written to

Modified:
    
incubator/npanday/trunk/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java

Modified: 
incubator/npanday/trunk/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java?rev=1221116&r1=1221115&r2=1221116&view=diff
==============================================================================
--- 
incubator/npanday/trunk/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java
 (original)
+++ 
incubator/npanday/trunk/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java
 Tue Dec 20 06:23:52 2011
@@ -256,12 +256,22 @@ public class VsInstallerMojo
         {
             String programFilesPath = System.getenv( "PROGRAMFILES" );
 
-            if ( programFilesPath == null || programFilesPath.length() == 0 )
+            if ( programFilesPath != null && programFilesPath.length() != 0 )
             {
-                programFilesPath = System.getProperty( "user.dir" );
-            }
+                installationLocation = new File ( programFilesPath, 
"NPanday/bin" );
 
-            installationLocation = new File ( programFilesPath, "NPanday/bin" 
);
+                if ( !installationLocation.exists() )
+                {
+                    if ( !installationLocation.mkdirs() )
+                    {
+                        installationLocation = new File( System.getProperty( 
"user.home" ), "NPanday/bin" );
+                    }
+                }
+            }
+            else
+            {
+                installationLocation = new File( System.getProperty( 
"user.home" ), "NPanday/bin" );
+            }
         }
         else
         {


Reply via email to