fix: detect AppData directory paths without trailing separators
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const WINDOWS_APPDATA_SEGMENTS = ["\\appdata\\local\\", "\\appdata\\roaming\\", "\\appdata\\locallow\\"]
|
||||
const WINDOWS_APPDATA_SEGMENTS = ["\\appdata\\local", "\\appdata\\roaming", "\\appdata\\locallow"]
|
||||
|
||||
function normalizeWindowsPath(directory: string): string {
|
||||
return directory.replaceAll("/", "\\").toLowerCase()
|
||||
@@ -6,7 +6,9 @@ function normalizeWindowsPath(directory: string): string {
|
||||
|
||||
export function isWindowsAppDataDirectory(directory: string): boolean {
|
||||
const normalizedDirectory = normalizeWindowsPath(directory)
|
||||
return WINDOWS_APPDATA_SEGMENTS.some((segment) => normalizedDirectory.includes(segment))
|
||||
return WINDOWS_APPDATA_SEGMENTS.some((segment) => {
|
||||
return normalizedDirectory.endsWith(segment) || normalizedDirectory.includes(`${segment}\\`)
|
||||
})
|
||||
}
|
||||
|
||||
export function resolveSessionDirectory(options: {
|
||||
|
||||
Reference in New Issue
Block a user