|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
576 bytes
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | function joinPath(pathArray)
|
|---|
| 4 | {
|
|---|
| 5 | if (pathArray.length > 0)
|
|---|
| 6 | {
|
|---|
| 7 | return pathArray.join("/") + "/";
|
|---|
| 8 | }
|
|---|
| 9 | else
|
|---|
| 10 | {
|
|---|
| 11 | return "";
|
|---|
| 12 | }
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 | function resolveDotSegments(pathArray)
|
|---|
| 18 | {
|
|---|
| 19 | var pathAbsolute = [];
|
|---|
| 20 |
|
|---|
| 21 | pathArray.forEach( function(dir)
|
|---|
| 22 | {
|
|---|
| 23 | if (dir !== "..")
|
|---|
| 24 | {
|
|---|
| 25 | if (dir !== ".")
|
|---|
| 26 | {
|
|---|
| 27 | pathAbsolute.push(dir);
|
|---|
| 28 | }
|
|---|
| 29 | }
|
|---|
| 30 | else
|
|---|
| 31 | {
|
|---|
| 32 | // Remove parent
|
|---|
| 33 | if (pathAbsolute.length > 0)
|
|---|
| 34 | {
|
|---|
| 35 | pathAbsolute.splice(pathAbsolute.length-1, 1);
|
|---|
| 36 | }
|
|---|
| 37 | }
|
|---|
| 38 | });
|
|---|
| 39 |
|
|---|
| 40 | return pathAbsolute;
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 | module.exports =
|
|---|
| 46 | {
|
|---|
| 47 | join: joinPath,
|
|---|
| 48 | resolveDotSegments: resolveDotSegments
|
|---|
| 49 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.