Author: jocaba Date: Wed Mar 23 08:02:35 2011 New Revision: 1084495 URL: http://svn.apache.org/viewvc?rev=1084495&view=rev Log: [NPANDAY-123] PATH should not have to be set for both Visual Studio AddIn or mvn command-line to function
Added a default setting of the netHome to the proper SDKs Modified: incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java Modified: incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java?rev=1084495&r1=1084494&r2=1084495&view=diff ============================================================================== --- incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java (original) +++ incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java Wed Mar 23 08:02:35 2011 @@ -419,11 +419,18 @@ public class NetExecutableFactoryImpl executableRequirement.setProfile( profile ); ExecutableConfig executableConfig = ExecutableConfig.Factory.createDefaultExecutableConfig(); - executableConfig.setCommands( commands ); + + executableConfig.setCommands( commands ); List<String> executablePaths = ( executableConfig.getExecutionPaths() == null ) ? new ArrayList<String>() : executableConfig.getExecutionPaths(); - if ( netHome != null ) + + if (netHome == null) + { + netHome = getNetHome(); + } + + if ( netHome != null ) { logger.info( "NPANDAY-066-014: Found executable path in pom: Path = " + netHome.getAbsolutePath() ); executablePaths.add( netHome.getAbsolutePath() ); @@ -455,4 +462,34 @@ public class NetExecutableFactoryImpl throw new PlatformUnsupportedException( "NPANDAY-066-001: Unable to find net executable", e ); } } + + private File getNetHome() + { + String nHome = ""; + + // 32 bit system + if( new File("C:/Program Files/Microsoft SDKs/Windows/v6.0A/bin/gacutil.exe").exists() && new File("C:/Program Files/Microsoft SDKs/Windows/v6.0A/bin/xsd.exe").exists() ) + { + nHome = "C:/Program Files/Microsoft SDKs/Windows/v6.0A/bin"; + } + if( new File("C:/Program Files/Microsoft SDKs/Windows/v7.0A/bin/gacutil.exe").exists() && new File("C:/Program Files/Microsoft SDKs/Windows/v7.0A/bin/xsd.exe").exists() ) + { + nHome = "C:/Program Files/Microsoft SDKs/Windows/v7.0A/bin"; + } + + // 64 bit system + if ( nHome != "" ) + { + if( new File("C:/Program Files (x86)/Microsoft SDKs/Windows/v6.0A/bin/gacutil.exe").exists() && new File("C:/Program Files (x86)/Microsoft SDKs/Windows/v6.0A/bin/xsd.exe").exists() ) + { + nHome = "C:/Program Files/Microsoft SDKs/Windows/v6.0A/bin"; + } + if( new File("C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/bin/gacutil.exe").exists() && new File("C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/bin/xsd.exe").exists() ) + { + nHome = "C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/bin"; + } + } + + return new File(nHome); + } }