class ChefConfig::PathHelper
def self.cleanpath(path, windows: ChefUtils.windows?)
-
(String)
- cleaned path
Parameters:
-
windows
(Boolean
) -- optional flag to force to windows or unix-style -
path
(String
) -- the path to clean
def self.cleanpath(path, windows: ChefUtils.windows?) path = Pathname.new(path).cleanpath.to_s if windows # ensure all forward slashes are backslashes path.gsub(File::SEPARATOR, path_separator(windows: windows)) else # ensure all backslashes are forward slashes path.gsub(BACKSLASH, File::SEPARATOR) end end