diff --git a/project.properties b/project.properties index 140132f..8192ecd 100644 --- a/project.properties +++ b/project.properties @@ -1,6 +1,6 @@ -#Tue, 25 Jan 2011 09:33:59 -0600 +#Mon, 05 Dec 2011 22:11:12 -0600 name=jdb-util -version=1.3 +version=1.4 lib.local=true -build.number=3 +build.number=8 diff --git a/src/main/com/jdbernard/util/SmartConfig.groovy b/src/main/com/jdbernard/util/SmartConfig.groovy index 227444f..3f80289 100644 --- a/src/main/com/jdbernard/util/SmartConfig.groovy +++ b/src/main/com/jdbernard/util/SmartConfig.groovy @@ -37,15 +37,15 @@ public class SmartConfig { catch (Exception e) { log.warn("Cannot save config file.", e) } } - def getProperty(String name) { getProperty(name, "") } + def getProperty(String name) { getProperty(name, null) } def getProperty(String name, Object defVal) { log.trace("Looking up {}", name) - def val = props.getProperty(name) + def val = props[name] - if (val == null) { + if (val == null && defVal != null) { log.trace("Doesn't exists, setting with given default") val = defVal @@ -83,9 +83,10 @@ public class SmartConfig { if (name ==~ /.*([dD]irectory|[dD]ir|[fF]ile)/) { log.trace("Interpreting as a file/directory.") - props."$name" = value.canonicalPath + if (!(value instanceof File)) { value = new File(value) } + props[name] = value.canonicalPath } else { - props."$name" = value.toString() + props[name] = value.toString() } save() }