fix(windows): accept ordinary drive path separators (#791)
This commit is contained in:
@@ -141,7 +141,12 @@ export class GhidraHeadlessLauncher implements GhidraLauncher {
|
||||
expectedCommand: null,
|
||||
windowsVerbatimArguments: platform === "win32",
|
||||
platform,
|
||||
env: ghidraLaunchEnvironment(paths, this.options.javaHome, platform),
|
||||
env: ghidraLaunchEnvironment(
|
||||
paths,
|
||||
this.options.javaHome,
|
||||
platform,
|
||||
command.command,
|
||||
),
|
||||
});
|
||||
await writeGhidraRuntimeFile(
|
||||
paths.ownershipPath,
|
||||
@@ -382,6 +387,7 @@ const ghidraLaunchEnvironment = (
|
||||
paths: ReturnType<typeof ghidraRuntimePaths>,
|
||||
javaHome: string | undefined,
|
||||
platform: NodeJS.Platform,
|
||||
executable: string,
|
||||
): NodeJS.ProcessEnv => {
|
||||
return {
|
||||
...ghidraJavaEnvironment(javaHome, process.env, platform),
|
||||
@@ -390,6 +396,9 @@ const ghidraLaunchEnvironment = (
|
||||
TMPDIR: paths.tempRoot,
|
||||
...(platform === "win32"
|
||||
? {
|
||||
// Batch FOR /F launches another command interpreter through ComSpec.
|
||||
// Use the same executable with the spelling consumed by cmd.exe.
|
||||
ComSpec: executable.replaceAll("/", "\\"),
|
||||
USERPROFILE: paths.homeRoot,
|
||||
APPDATA: paths.configRoot,
|
||||
LOCALAPPDATA: paths.cacheRoot,
|
||||
|
||||
@@ -62,7 +62,9 @@ export class WindowsOwnedProcess extends EventEmitter {
|
||||
.filter((entry): entry is [string, string] => entry[1] !== undefined)
|
||||
.map(([key, value]) => `${key}=${value}`);
|
||||
const line = [
|
||||
quoteWindowsProcessArgument(command),
|
||||
// cmd.exe parses its own command line rather than the CRT argv rules;
|
||||
// its executable token must match the native drive-path representation.
|
||||
quoteWindowsProcessArgument(command.replaceAll("/", "\\")),
|
||||
...arguments_.map((value) =>
|
||||
verbatim ? value : quoteWindowsProcessArgument(value),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user