normalize-windows-path.js 410 B

12345678
  1. // on windows, either \ or / are valid directory separators.
  2. // on unix, \ is a valid character in filenames.
  3. // so, on windows, and only on windows, we replace all \ chars with /,
  4. // so that we can use / as our one and only directory separator char.
  5. const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform
  6. module.exports = platform !== 'win32' ? p => p
  7. : p => p && p.replace(/\\/g, '/')