blob: e9e9a5b11a6c805520aa8c58d676f74e29e5ea6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
"use strict";
const path = require("path");
module.exports = function relative(root, file) {
const rootPath = root.replace(/\\/g, "/").split("/")[1];
const filePath = file.replace(/\\/g, "/").split("/")[1]; // If the file is in a completely different root folder
// use the absolute path of the file
if (rootPath && rootPath !== filePath) {
return file;
}
return path.relative(root, file);
};
|