diff --git a/src/activateMockDebug.ts b/src/activateMockDebug.ts index e3bc85e..0e83b96 100644 --- a/src/activateMockDebug.ts +++ b/src/activateMockDebug.ts @@ -183,6 +183,7 @@ class MockConfigurationProvider implements vscode.DebugConfigurationProvider { } export const workspaceFileAccessor: FileAccessor = { + isWindows: false, async readFile(path: string): Promise { let uri: vscode.Uri; try { diff --git a/src/debugAdapter.ts b/src/debugAdapter.ts index 63f7b3f..52d1cc4 100644 --- a/src/debugAdapter.ts +++ b/src/debugAdapter.ts @@ -17,6 +17,7 @@ import { FileAccessor } from './mockRuntime'; * So we can only use node.js API for accessing files. */ const fsAccessor: FileAccessor = { + isWindows: process.platform === 'win32', readFile(path: string): Promise { return fs.readFile(path); }, diff --git a/src/mockRuntime.ts b/src/mockRuntime.ts index e4e5d04..1bebfe7 100644 --- a/src/mockRuntime.ts +++ b/src/mockRuntime.ts @@ -5,6 +5,7 @@ import { EventEmitter } from 'events'; export interface FileAccessor { + isWindows: boolean; readFile(path: string): Promise; writeFile(path: string, contents: Uint8Array): Promise; } @@ -674,7 +675,7 @@ export class MockRuntime extends EventEmitter { } private normalizePathAndCasing(path: string) { - if (process.platform === 'win32') { + if (this.fileAccessor.isWindows) { return path.replace(/\//g, '\\').toLowerCase(); } else { return path.replace(/\\/g, '/');