summaryrefslogtreecommitdiff
path: root/DOC_CHANGES.md
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-09-19 12:58:55 -0700
committerClaire McQuin <claire@getchef.com>2014-09-22 11:22:54 -0700
commit99108df1d41f63e424e0a1ddd07cfc966ee6381a (patch)
tree920bf85c244b3730cc6c581fb1a0f9ca145a3bba /DOC_CHANGES.md
parentc88a198f1612b806261fde30ac17871b4d98a85d (diff)
downloadchef-99108df1d41f63e424e0a1ddd07cfc966ee6381a.tar.gz
Update for new PathHelper method escape_glob.
Diffstat (limited to 'DOC_CHANGES.md')
-rw-r--r--DOC_CHANGES.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/DOC_CHANGES.md b/DOC_CHANGES.md
index ad45e4c383..38a8a8c4f6 100644
--- a/DOC_CHANGES.md
+++ b/DOC_CHANGES.md
@@ -172,3 +172,22 @@ end
# the `:immediate` is required for results to be defined.
notifies :reboot_now, "reboot[now]", :immediate
```
+
+### Escape sensitive characters before globbing
+Some paths contain characters reserved by glob and must be escaped so that
+glob operations perform as expected. One common example is Windows file paths
+separated by `"\\"`. To ensure that your globs work correctly, it is recommended
+that you apply `Chef::Util::PathHelper::escape_glob` before globbing file paths.
+
+```ruby
+path = "C:\\Users\\me\\chef-repo\\cookbooks"
+Dir.exist?(path) # true
+Dir.entries(path) # [".", "..", "apache2", "apt", ...]
+
+Dir.glob(File.join(path, "*")) # []
+Dir[File.join(path, "*")] # []
+
+PathHelper = Chef::Util::PathHelper
+Dir.glob(File.join(PathHelper.escape_glob(path), "*")) # ["#{path}\\apache2", "#{path}\\apt", ...]
+Dir[PathHelper.escape_glob(path) + "/*"] # ["#{path}\\apache2", "#{path}\\apt", ...]
+```