You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-dev@incubator.apache.org by Brett Porter <br...@apache.org> on 2011/05/02 01:39:26 UTC
Re: svn commit: r1098424 - in /incubator/npanday/trunk: components/dotnet-vendor/src/main/java/npanday/vendor/ components/dotnet-vendor/src/main/java/npanday/vendor/impl/ plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/
On 02/05/2011, at 8:19 AM, lcorneliussen@apache.org wrote:
> Modified: incubator/npanday/trunk/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java
> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java?rev=1098424&r1=1098423&r2=1098424&view=diff
> ==============================================================================
> --- incubator/npanday/trunk/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java (original)
> +++ incubator/npanday/trunk/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java Sun May 1 22:19:50 2011
> @@ -35,7 +35,7 @@ import java.util.Hashtable;
> public class SettingsUtil
> {
> /**
> - * Return the registered settings, or create from default settings file location (.m2/npanday-settings.xml)
> + * Return the registered settings, or create from configured (-Dnpanday-settings=...) or default settings file location (.m2/npanday-settings.xml)
> * @param repositoryRegistry The registry.
> * @return The current, or just created SettingsRepository
> * @throws SettingsException If anything goes wrong reading or registering the settings
> @@ -43,7 +43,13 @@ public class SettingsUtil
> public static SettingsRepository getOrPopulateSettingsRepository( RepositoryRegistry repositoryRegistry)
> throws SettingsException
> {
> - return getOrPopulateSettingsRepository(repositoryRegistry, PathUtil.getHomeM2Folder());
> + String settingsFolder = PathUtil.getHomeM2Folder();
> + String customFolder = System.getProperty( "npanday.settings" );
> + if (customFolder != null && customFolder != "")
This won't necessarily work, as string comparisons aren't native. You want !"".equals(customFolder), or use something like !StringUtils.isEmpty for the whole line.
> + {
> + settingsFolder = customFolder;
> + }
> + return getOrPopulateSettingsRepository(repositoryRegistry, settingsFolder );
> }
>
> /**
>
>
> Modified: incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/PathUtil.cs
> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/PathUtil.cs?rev=1098424&r1=1098423&r2=1098424&view=diff
> ==============================================================================
> --- incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/PathUtil.cs (original)
> +++ incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/PathUtil.cs Sun May 1 22:19:50 2011
> @@ -17,12 +17,29 @@
> // under the License.
> //
>
> +using System;
> using System.IO;
>
> namespace NPanday.Plugin.Settings
> {
> + // TODO: Move this to common PathUtil, when NPANDAY-422 is fixed
> public static class PathUtil
> {
> + public static string GetHomeM2Folder()
> + {
> + return Environment.GetEnvironmentVariable("USERPROFILE") + "/.m2";
> + }
> +
> + public static string BuildSettingsFilePath( string settingsPathOrFile )
> + {
> + if (settingsPathOrFile.EndsWith( "xml" ))
> + {
> + return settingsPathOrFile;
> + }
Same comment as before - this would be more robust if there was a way to check isDirectory or isFile instead.
- Brett
--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter
Re: svn commit: r1098424 - in /incubator/npanday/trunk: components/dotnet-vendor/src/main/java/npanday/vendor/ components/dotnet-vendor/src/main/java/npanday/vendor/impl/ plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/
Posted by Lars Corneliussen <me...@lcorneliussen.de>.
--
Message sent from mobile device
Am 02.05.2011 um 03:39 schrieb Brett Porter <br...@apache.org>:
>
> On 02/05/2011, at 8:19 AM, lcorneliussen@apache.org wrote:
>
>> Modified: incubator/npanday/trunk/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java?rev=1098424&r1=1098423&r2=1098424&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java (original)
>> +++ incubator/npanday/trunk/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java Sun May 1 22:19:50 2011
>> @@ -35,7 +35,7 @@ import java.util.Hashtable;
>> public class SettingsUtil
>> {
>> /**
>> - * Return the registered settings, or create from default settings file location (.m2/npanday-settings.xml)
>> + * Return the registered settings, or create from configured (-Dnpanday-settings=...) or default settings file location (.m2/npanday-settings.xml)
>> * @param repositoryRegistry The registry.
>> * @return The current, or just created SettingsRepository
>> * @throws SettingsException If anything goes wrong reading or registering the settings
>> @@ -43,7 +43,13 @@ public class SettingsUtil
>> public static SettingsRepository getOrPopulateSettingsRepository( RepositoryRegistry repositoryRegistry)
>> throws SettingsException
>> {
>> - return getOrPopulateSettingsRepository(repositoryRegistry, PathUtil.getHomeM2Folder());
>> + String settingsFolder = PathUtil.getHomeM2Folder();
>> + String customFolder = System.getProperty( "npanday.settings" );
>> + if (customFolder != null && customFolder != "")
>
> This won't necessarily work, as string comparisons aren't native. You want !"".equals(customFolder), or use something like !StringUtils.isEmpty for the whole line.
i'll fix that.
>
>> + {
>> + settingsFolder = customFolder;
>> + }
>> + return getOrPopulateSettingsRepository(repositoryRegistry, settingsFolder );
>> }
>>
>> /**
>>
>>
>> Modified: incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/PathUtil.cs
>> URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/PathUtil.cs?rev=1098424&r1=1098423&r2=1098424&view=diff
>> ==============================================================================
>> --- incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/PathUtil.cs (original)
>> +++ incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/PathUtil.cs Sun May 1 22:19:50 2011
>> @@ -17,12 +17,29 @@
>> // under the License.
>> //
>>
>> +using System;
>> using System.IO;
>>
>> namespace NPanday.Plugin.Settings
>> {
>> + // TODO: Move this to common PathUtil, when NPANDAY-422 is fixed
>> public static class PathUtil
>> {
>> + public static string GetHomeM2Folder()
>> + {
>> + return Environment.GetEnvironmentVariable("USERPROFILE") + "/.m2";
>> + }
>> +
>> + public static string BuildSettingsFilePath( string settingsPathOrFile )
>> + {
>> + if (settingsPathOrFile.EndsWith( "xml" ))
>> + {
>> + return settingsPathOrFile;
>> + }
>
> Same comment as before - this would be more robust if there was a way to check isDirectory or isFile instead.
when it doesn't exist, we still need to determine if it is a file or a directory. This might also have been liits thoughts when reqiring a dir, instead of a file - because npanday both writes, reads and overwrites the file.
>
> - Brett
>
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
> http://au.linkedin.com/in/brettporter
>
>
>
>