Skip to content

Commit

Permalink
[bugfix] fix pathes was not normalized correctly, closes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
jkb0o committed Feb 27, 2021
1 parent 88f4265 commit c2d0934
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/commands/fix_path.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as path from "../lib/path";
let p = path.normalize('c:\\myFolder\\otherFolder\\IamHere.exe')
fl.trace(p)
6 changes: 4 additions & 2 deletions src/lib/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@


export function normalize(path: string): string {
path = path.replace("\\", "/");
while (path.search("//") >= 0) {
while (path.indexOf("\\") >= 0) {
path = path.replace("\\", "/");
}
while (path.indexOf("//") >= 0) {
path = path.replace("//", "/");
}
while (path.endsWith("/")) {
Expand Down

0 comments on commit c2d0934

Please sign in to comment.