Mark some Mac paths as too broad and normalize paths ending with *
This commit is contained in:
parent
92fcbe1f1d
commit
faf32b040a
2 changed files with 86 additions and 100 deletions
21
src/wiki.ts
21
src/wiki.ts
|
@ -314,14 +314,17 @@ function parsePath(path: string): [string, PathType] {
|
|||
}
|
||||
}
|
||||
|
||||
return [
|
||||
path
|
||||
.replace(/\\/g, "/")
|
||||
.replace(/\/{2,}/g, "/")
|
||||
.replace(/\/(?=$)/g, "")
|
||||
.replace(/^~(?=($|\/))/, "<home>"),
|
||||
pathType,
|
||||
];
|
||||
path = path
|
||||
.replace(/\\/g, "/")
|
||||
.replace(/\/{2,}/g, "/")
|
||||
.replace(/\/(?=$)/g, "")
|
||||
.replace(/^~(?=($|\/))/, "<home>");
|
||||
|
||||
while (path.endsWith("/*")) {
|
||||
path = path.slice(0, path.length - 2);
|
||||
}
|
||||
|
||||
return [path, pathType];
|
||||
}
|
||||
|
||||
export function pathIsTooBroad(path: string): boolean {
|
||||
|
@ -343,6 +346,8 @@ export function pathIsTooBroad(path: string): boolean {
|
|||
"<home>/AppData/Roaming",
|
||||
"<home>/Documents/My Games",
|
||||
"<winDocuments>/My Games",
|
||||
"<home>/Library/Application Support",
|
||||
"<home>/Library/Preferences",
|
||||
].includes(path)) {
|
||||
return true;
|
||||
}
|
||||
|
|
Reference in a new issue