Skip to content

Commit

Permalink
Modified the 'FSPath' to remove '//' sequences ('//' => '/')
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed Jun 19, 2017
1 parent ccb786e commit 0315270
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 7 additions & 2 deletions lib/manager/FSPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
Object.defineProperty(exports, "__esModule", { value: true });
var FSPath = (function () {
function FSPath(path) {
if (path.constructor === String)
this.paths = path.replace(/(^\/|\/$)/g, '').split('/');
if (path.constructor === String) {
var sPath = path;
var doubleIndex = void 0;
while ((doubleIndex = sPath.indexOf('//')) !== -1)
sPath = sPath.substr(0, doubleIndex) + sPath.substr(doubleIndex + 1);
this.paths = sPath.replace(/(^\/|\/$)/g, '').split('/');
}
else if (path.constructor === FSPath)
this.paths = path.paths.filter(function (x) { return true; });
else
Expand Down
8 changes: 7 additions & 1 deletion src/manager/FSPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ export class FSPath
constructor(path : FSPath | string[] | string)
{
if(path.constructor === String)
this.paths = (path as string).replace(/(^\/|\/$)/g, '').split('/');
{
let sPath = (path as string);
let doubleIndex;
while((doubleIndex = sPath.indexOf('//')) !== -1)
sPath = sPath.substr(0, doubleIndex) + sPath.substr(doubleIndex + 1);
this.paths = sPath.replace(/(^\/|\/$)/g, '').split('/');
}
else if(path.constructor === FSPath)
this.paths = (path as FSPath).paths.filter((x) => true); // clone
else
Expand Down

0 comments on commit 0315270

Please sign in to comment.