class ChefConfig::PathHelper

def self.validate_path(path, windows: ChefUtils.windows?)

def self.validate_path(path, windows: ChefUtils.windows?)
  if windows
    unless printable?(path)
      msg = "Path '#{path}' contains non-printable characters. Check that backslashes are escaped with another backslash (e.g. C:\\\\Windows) in double-quoted strings."
      ChefConfig.logger.error(msg)
      raise ChefConfig::InvalidPath, msg
    end
    if windows_max_length_exceeded?(path)
      ChefConfig.logger.trace("Path '#{path}' is longer than #{WIN_MAX_PATH}, prefixing with'\\\\?\\'")
      path.insert(0, "\\\\?\\")
    end
  end
  path
end