2026-01-30 13:31:20 +01:00
|
|
|
import * as path from 'path';
|
2022-10-21 16:52:45 +02:00
|
|
|
/**
|
|
|
|
|
* toPosixPath converts the given path to the posix form. On Windows, \\ will be
|
|
|
|
|
* replaced with /.
|
|
|
|
|
*
|
|
|
|
|
* @param pth. Path to transform.
|
|
|
|
|
* @return string Posix path.
|
|
|
|
|
*/
|
2026-01-30 13:31:20 +01:00
|
|
|
export function toPosixPath(pth) {
|
2022-10-21 16:52:45 +02:00
|
|
|
return pth.replace(/[\\]/g, '/');
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* toWin32Path converts the given path to the win32 form. On Linux, / will be
|
|
|
|
|
* replaced with \\.
|
|
|
|
|
*
|
|
|
|
|
* @param pth. Path to transform.
|
|
|
|
|
* @return string Win32 path.
|
|
|
|
|
*/
|
2026-01-30 13:31:20 +01:00
|
|
|
export function toWin32Path(pth) {
|
2022-10-21 16:52:45 +02:00
|
|
|
return pth.replace(/[/]/g, '\\');
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* toPlatformPath converts the given path to a platform-specific path. It does
|
|
|
|
|
* this by replacing instances of / and \ with the platform-specific path
|
|
|
|
|
* separator.
|
|
|
|
|
*
|
|
|
|
|
* @param pth The path to platformize.
|
|
|
|
|
* @return string The platform-specific path.
|
|
|
|
|
*/
|
2026-01-30 13:31:20 +01:00
|
|
|
export function toPlatformPath(pth) {
|
2022-10-21 16:52:45 +02:00
|
|
|
return pth.replace(/[/\\]/g, path.sep);
|
|
|
|
|
}
|
|
|
|
|
//# sourceMappingURL=path-utils.js.map
|