Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vscode): windows pathe format #1645

Merged
merged 2 commits into from Sep 26, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/vscode/src/contextLoader.ts
Expand Up @@ -83,6 +83,7 @@ export class ContextLoader {
}

async loadContextInDirectory(dir: string) {
const normalizedDir = normalizeWindowsPath(dir)
const cached = this.contextsMap.get(dir)
if (cached !== undefined)
return cached
Expand Down Expand Up @@ -135,7 +136,7 @@ export class ContextLoader {
return null

const baseDir = dirname(sources[0])
if (baseDir !== dir) {
if (baseDir !== normalizedDir) {
// exists on upper level, skip
this.contextsMap.set(dir, null)
return null
Expand Down Expand Up @@ -250,3 +251,11 @@ export class ContextLoader {
return this.defaultContext
}
}

// Util to normalize windows paths to posix
function normalizeWindowsPath(input = '') {
zyyv marked this conversation as resolved.
Show resolved Hide resolved
if (!input || !input.includes('\\'))
return input

return input.replace(/\\/g, '/')
}