fix(linux): improve Hopper reliability and CachyOS support (#963)
* fix(linux): support CachyOS Hopper hosts * fix(config): reuse user-local Hopper launcher * fix(hopper): harden Linux demo dialog handling * chore: retrigger CI after PR title fix * fix(linux): align Hopper defaults and support docs --------- Co-authored-by: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com>
This commit is contained in:
@@ -1,13 +1,36 @@
|
||||
import { accessSync, constants } from "node:fs";
|
||||
import { homedir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { ConfigurationError } from "../domain/configurationErrors.js";
|
||||
import { ok, type Result } from "../domain/result.js";
|
||||
import { parseEnvironment } from "./environment.js";
|
||||
import { parseStringArray, parseLoaderArgs } from "./parsers.js";
|
||||
import type { AppConfig } from "./types.js";
|
||||
|
||||
const defaultHopperLauncherPath = (): string =>
|
||||
process.platform === "linux"
|
||||
? "/opt/hopper/bin/Hopper"
|
||||
: "/Applications/Hopper Disassembler.app/Contents/MacOS/hopper";
|
||||
const DEFAULT_HOPPER_LAUNCHER_PATH =
|
||||
"/Applications/Hopper Disassembler.app/Contents/MacOS/hopper";
|
||||
const SYSTEM_LINUX_HOPPER = "/opt/hopper/bin/Hopper";
|
||||
|
||||
const executableAvailable = (path: string): boolean => {
|
||||
try {
|
||||
accessSync(path, constants.X_OK);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export const defaultHopperLauncherPath = (
|
||||
platform: NodeJS.Platform = process.platform,
|
||||
homeDirectory: string = homedir(),
|
||||
executable: (path: string) => boolean = executableAvailable,
|
||||
): string => {
|
||||
if (platform !== "linux") return DEFAULT_HOPPER_LAUNCHER_PATH;
|
||||
if (executable(SYSTEM_LINUX_HOPPER)) return SYSTEM_LINUX_HOPPER;
|
||||
const userLocal = join(homeDirectory, ".local/share/rea/hopper/bin/Hopper");
|
||||
return executable(userLocal) ? userLocal : SYSTEM_LINUX_HOPPER;
|
||||
};
|
||||
|
||||
/** Parse provider configuration and runtime prerequisites at the composition root. */
|
||||
export const parseConfig = (
|
||||
|
||||
Reference in New Issue
Block a user