refactor: unwrap Protected namespace + self-reexport (#22938)
This commit is contained in:
@@ -37,16 +37,15 @@ const DARWIN_ROOT = ["/.DocumentRevisions-V100", "/.Spotlight-V100", "/.Trashes"
|
|||||||
|
|
||||||
const WIN32_HOME = ["AppData", "Downloads", "Desktop", "Documents", "Pictures", "Music", "Videos", "OneDrive"]
|
const WIN32_HOME = ["AppData", "Downloads", "Desktop", "Documents", "Pictures", "Music", "Videos", "OneDrive"]
|
||||||
|
|
||||||
export namespace Protected {
|
/** Directory basenames to skip when scanning the home directory. */
|
||||||
/** Directory basenames to skip when scanning the home directory. */
|
export function names(): ReadonlySet<string> {
|
||||||
export function names(): ReadonlySet<string> {
|
|
||||||
if (process.platform === "darwin") return new Set(DARWIN_HOME)
|
if (process.platform === "darwin") return new Set(DARWIN_HOME)
|
||||||
if (process.platform === "win32") return new Set(WIN32_HOME)
|
if (process.platform === "win32") return new Set(WIN32_HOME)
|
||||||
return new Set()
|
return new Set()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Absolute paths that should never be watched, stated, or scanned. */
|
/** Absolute paths that should never be watched, stated, or scanned. */
|
||||||
export function paths(): string[] {
|
export function paths(): string[] {
|
||||||
if (process.platform === "darwin")
|
if (process.platform === "darwin")
|
||||||
return [
|
return [
|
||||||
...DARWIN_HOME.map((n) => path.join(home, n)),
|
...DARWIN_HOME.map((n) => path.join(home, n)),
|
||||||
@@ -55,5 +54,6 @@ export namespace Protected {
|
|||||||
]
|
]
|
||||||
if (process.platform === "win32") return WIN32_HOME.map((n) => path.join(home, n))
|
if (process.platform === "win32") return WIN32_HOME.map((n) => path.join(home, n))
|
||||||
return []
|
return []
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export * as Protected from "./protected"
|
||||||
|
|||||||
Reference in New Issue
Block a user