summaryrefslogtreecommitdiffstats
path: root/lib/puppet/type/file/source.rb
diff options
context:
space:
mode:
authorJacob Helwig <jacob@puppetlabs.com>2011-08-02 10:46:53 -0700
committerJacob Helwig <jacob@puppetlabs.com>2011-08-19 13:52:58 -0700
commit4a6d61717eb54a0cefff87bf67ae62df1e3b4317 (patch)
treeee91cde7a7c1e510430b44a1a9c36eb8dfd80b4a /lib/puppet/type/file/source.rb
parent8c889187a4699f8b797e7a960343558fd2cb8e34 (diff)
downloadpuppet-4a6d61717eb54a0cefff87bf67ae62df1e3b4317.tar.gz
puppet-4a6d61717eb54a0cefff87bf67ae62df1e3b4317.tar.xz
puppet-4a6d61717eb54a0cefff87bf67ae62df1e3b4317.zip
Consolidate test logic determining if a registered file is in the temp directory
Previously, we were always using string comparisons, and hard-coded paths to temp locations on non-Windows platforms. This was problematic for a few reasons. We had to maintain a list of temp locations for the various platforms, and the string comparisons were unreliable on Windows, since paths have two string representations (the "short" name containing a ~ followed by a number, and the "full" name). By getting the current temp location using Dir.tempdir (the same mechanism our temp creation code uses), we no longer need to maintain the list of temp locations. Also, rather than doing string comparisons on file paths, we can use a combination of Pathname#ascend, and File.identical? to determine if the path registered as a temp file for deletion was actually created in the temp location. With this refactoring, the same code now works for both Windows, and non-Windows platforms. Reviewed-by: Nick Lewis <nick@puppetlabs.com> (cherry picked from commit 3aec02ba0e4bda8ba4e9fffbc6defaae4e4e2ba1)
Diffstat (limited to 'lib/puppet/type/file/source.rb')
0 files changed, 0 insertions, 0 deletions