Files
holesail-browser/native-host/host/paths.js
T
Raven Scott 15caac7032
CI / Build & Test (push) Successful in 2m46s
refactor(native-host): modularize host.js and holesail-manager.js
Split host.js (435 lines) into host/{paths,logger,startup,message-router}.js.
Split holesail-manager.js (698 lines) into holesail-manager/{state,settings,
connections,port-allocator,servers,virtual-hosts,service-tunnels,index}.js.

Top-level host.js and holesail-manager.js become thin shims so index.mjs
requires no changes. Deleted dev scratch file test-cp.mjs.

Updated CI with 12 new node --check lines for all sub-modules.
Updated docs/ARCHITECTURE.md with per-file tables for host/ and
holesail-manager/ sub-modules.

No functionality changed. No new dependencies.
2026-02-28 23:15:08 -05:00

25 lines
797 B
JavaScript

/**
* Resolves the base directory for storage and logging.
* When running as a standalone Bare binary, __dirname is bare:/app.bundle/
* which is not a real filesystem path — use the executable's directory instead.
* In development (bare index.mjs), __dirname is the native-host/ directory.
*/
const path = require('bare-path');
function resolveBase() {
try {
const os = require('bare-os');
const execPath = os.execPath();
if (execPath && !execPath.startsWith('bare:')) {
return path.dirname(execPath);
}
} catch (_) {}
return __dirname.replace(/[/\\]host$/, ''); // strip the /host suffix to get native-host/
}
const BASE_DIR = resolveBase();
const STORAGE_PATH = path.join(BASE_DIR, 'holesail-browser-storage');
module.exports = { BASE_DIR, STORAGE_PATH };