Skip to content

Commit

Permalink
fix: Replace special characters in paths consistently on all platforms
Browse files Browse the repository at this point in the history
Even though some of the characters are technically legal on some
platforms, they might still be inconvenient and inconsistent.

Fixes #134
  • Loading branch information
dividedmind committed Mar 27, 2024
1 parent d035419 commit c06fa30
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Recording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ function makeAppMapFilename(name: string): string {
return name + ".appmap.json";
}

const charsToQuote = process.platform == "win32" ? /[/\\:<>*"|?]/g : /[/\\]/g;
function quotePathSegment(value: string): string {
// note replacing spaces isn't strictly necessary improves UX
return value.replaceAll(charsToQuote, "-").replaceAll(" ", "_");
// note replacing spaces isn't strictly necessary but improves UX
return value.replaceAll(/[/\\:<>*"|?]/g, "-").replaceAll(" ", "_");
}

0 comments on commit c06fa30

Please sign in to comment.