class ChefConfig::PathHelper
def self.cleanpath(path)
Generally, if the user isn't going to be seeing it, you should be
backwhacks on Windows.
not necessary or desired to blindly convert pathnames to have
generally be stored with forward slashes for consistency. It is
to the user with backwhacks. Internally, filename paths should
should only be used for *DISPLAY* logic to send strings back
Windows APIs all consume forward slashes, this helper function
slashes to backwhacks for Windows. Since the Ruby API and the
This is the INVERSE of Pathname#cleanpath, it converts forward
def self.cleanpath(path) path = Pathname.new(path).cleanpath.to_s # ensure all forward slashes are backslashes if ChefConfig.windows? path = path.gsub(File::SEPARATOR, path_separator) end path end