Skip to content

Commit 82e7b9b

Browse files
committed
Fix escaping of Windows paths when using "Pick assembly"
- Assemblies could not be decompiled when added through "Pick assembly".
1 parent feade33 commit 82e7b9b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

vscode-extension/src/commands/utils.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ export function addAssemblyFromFilePath(
1313
decompiledTreeProvider: DecompiledTreeProvider,
1414
decompiledTreeView: vscode.TreeView<MemberNode>
1515
) {
16-
let escaped: string = filePath.replace(/\\/g, "\\\\");
17-
if (escaped[0] === '"' && escaped[escaped.length - 1] === '"') {
18-
escaped = escaped.slice(1, -1);
16+
let assemblyFile = filePath;
17+
if (
18+
assemblyFile[0] === '"' &&
19+
assemblyFile[assemblyFile.length - 1] === '"'
20+
) {
21+
assemblyFile = assemblyFile.slice(1, -1);
1922
}
2023

2124
try {
22-
fs.accessSync(escaped, fs.constants.R_OK);
23-
addAssemblyToTree(escaped, decompiledTreeProvider, decompiledTreeView);
25+
fs.accessSync(assemblyFile, fs.constants.R_OK);
26+
addAssemblyToTree(assemblyFile, decompiledTreeProvider, decompiledTreeView);
2427
} catch (err) {
2528
vscode.window.showErrorMessage("Cannot read the file " + filePath);
2629
}

0 commit comments

Comments
 (0)