diff options
| author | David Schmitt <david@dasz.at> | 2010-04-30 11:34:52 +0200 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | 97c043f440115fcfd9d3ddaad59af5c8da875329 (patch) | |
| tree | 8839b56dd3713b69e88b82f2031e41857615bc18 /lib/puppet/util/settings | |
| parent | f80b4c73bb17af8b103cbc2562f8617755e93d3f (diff) | |
| download | puppet-97c043f440115fcfd9d3ddaad59af5c8da875329.tar.gz puppet-97c043f440115fcfd9d3ddaad59af5c8da875329.tar.xz puppet-97c043f440115fcfd9d3ddaad59af5c8da875329.zip | |
Fix path handling
*) Use File.expand_path as indicator for being an absolute path
*) Use basename instead of parsing the path manually
Diffstat (limited to 'lib/puppet/util/settings')
| -rw-r--r-- | lib/puppet/util/settings/file_setting.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/puppet/util/settings/file_setting.rb b/lib/puppet/util/settings/file_setting.rb index 2dfbcf46e..732af0b09 100644 --- a/lib/puppet/util/settings/file_setting.rb +++ b/lib/puppet/util/settings/file_setting.rb @@ -49,9 +49,9 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting # the variable 'dir', or adding a slash at the end. def munge(value) # If it's not a fully qualified path... - if value.is_a?(String) and value !~ /^\$/ and value !~ /^\// and value != 'false' + if value.is_a?(String) and value !~ /^\$/ and value != 'false' # Make it one - value = File.join(Dir.getwd, value) + value = File.expand_path(value) end if value.to_s =~ /\/$/ @type = :directory @@ -83,7 +83,7 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting return nil unless path.is_a?(String) # Make sure the paths are fully qualified. - path = File.join(Dir.getwd, path) unless path =~ /^\// + path = File.expand_path(path) return nil unless type == :directory or create_files? or File.exist?(path) return nil if path =~ /^\/dev/ |
