Skip to content

Commit

Permalink
Improved seperator replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
4Source committed May 25, 2024
1 parent 7511a19 commit 5b29ae1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/util/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@ export function stringTrimStart(str: string): [string, string] {
* if toCheck = "root/s" -> false
*/
export function isEqualOrSubPath(toCheck: string, rootPath: string): boolean {
const rootPathSections = normalize(rootPath.toLowerCase().replaceAll(/(\\\\|\/)/g, sep))
const rootPathSections = normalize(rootPath.toLowerCase())
.replaceAll(/(\\|\/)/g, sep)
.split(sep)
.filter((p) => p !== "");
const pathSections = normalize(toCheck.toLowerCase().replaceAll(/(\\\\|\/)/g, sep))
const pathSections = normalize(toCheck.toLowerCase())
.replaceAll(/(\\|\/)/g, sep)
.split(sep)
.filter((p) => p !== "");
if (pathSections.length < rootPathSections.length) {
Expand Down

0 comments on commit 5b29ae1

Please sign in to comment.