mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 17:57:36 +08:00
R=jacktfranklin@chromium.org Bug: 1213034 Change-Id: I5da8225f60b53870a1c67d6b5d02a464c08f4eb2 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2917088 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
50 lines
576 B
JavaScript
50 lines
576 B
JavaScript
"use strict";
|
|
|
|
function joinPath(pathArray)
|
|
{
|
|
if (pathArray.length > 0)
|
|
{
|
|
return pathArray.join("/") + "/";
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function resolveDotSegments(pathArray)
|
|
{
|
|
var pathAbsolute = [];
|
|
|
|
pathArray.forEach( function(dir)
|
|
{
|
|
if (dir !== "..")
|
|
{
|
|
if (dir !== ".")
|
|
{
|
|
pathAbsolute.push(dir);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// Remove parent
|
|
if (pathAbsolute.length > 0)
|
|
{
|
|
pathAbsolute.splice(pathAbsolute.length-1, 1);
|
|
}
|
|
}
|
|
});
|
|
|
|
return pathAbsolute;
|
|
}
|
|
|
|
|
|
|
|
module.exports =
|
|
{
|
|
join: joinPath,
|
|
resolveDotSegments: resolveDotSegments
|
|
};
|