+10
-2
@@ -1,6 +1,14 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
let isSingleExecutableApp = false;
|
||||
try {
|
||||
const sea = require('node:sea');
|
||||
isSingleExecutableApp = typeof sea.isSea === 'function' && sea.isSea();
|
||||
} catch {
|
||||
isSingleExecutableApp = false;
|
||||
}
|
||||
|
||||
const CONFIG_FILE_NAME = 'config.json';
|
||||
const DEFAULT_CONFIG_TEMPLATE = JSON.stringify({
|
||||
apiKeys: [
|
||||
@@ -56,12 +64,12 @@ const DEFAULT_CONFIG_TEMPLATE = JSON.stringify({
|
||||
}, null, 2) + '\n';
|
||||
|
||||
function getDefaultConfigPath() {
|
||||
const packagedApp = Boolean(process.pkg);
|
||||
const packagedApp = isSingleExecutableApp;
|
||||
return path.resolve(packagedApp ? path.dirname(process.execPath) : process.cwd(), CONFIG_FILE_NAME);
|
||||
}
|
||||
|
||||
function getConfigPathCandidates() {
|
||||
const packagedApp = Boolean(process.pkg);
|
||||
const packagedApp = isSingleExecutableApp;
|
||||
const externalDefault = getDefaultConfigPath();
|
||||
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user