mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
21 lines
491 B
JavaScript
21 lines
491 B
JavaScript
function toDosPath(path) {
|
|
if (path[0] === "/") {
|
|
if (! /^\/[A-Za-z](\/|$)/.test(path)) {
|
|
throw new Error("Surprising path: " + path);
|
|
}
|
|
// transform a previously windows path back
|
|
// "/C/something" to "c:/something"
|
|
path = path[1] + ":" + path.slice(2);
|
|
}
|
|
return path.split("/").join("\\");
|
|
}
|
|
|
|
function convertToOSPath(path) {
|
|
if (process.platform === "win32") {
|
|
return toDosPath(path);
|
|
}
|
|
return path;
|
|
}
|
|
|
|
exports.convertToOSPath = convertToOSPath;
|