Create data root if not exists in standalone mode Supersedes #5217

334635ce7487142699e31107201763557772f560

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +6 -2Ignore whitespace
src/command-line.js+6 -2
@@ -281,8 +281,12 @@ export class CommandLineParser {
281 const dataRoot = isGlobal281 const dataRoot = isGlobal
282 ? defaultConfig.dataRoot282 ? defaultConfig.dataRoot
283 : (cliArguments.dataRoot ?? getConfigValue('dataRoot', defaultConfig.dataRoot));283 : (cliArguments.dataRoot ?? getConfigValue('dataRoot', defaultConfig.dataRoot));
284 if (isGlobal && !fs.existsSync(dataRoot)) {284 try {
285 fs.mkdirSync(dataRoot, { recursive: true });285 if (!fs.existsSync(dataRoot)) {
286 fs.mkdirSync(dataRoot, { recursive: true });
287 }
288 } catch (err) {
289 console.warn(color.yellow(`Warning: Failed to create data root directory at ${dataRoot}. Please make sure the path is correct and writable.`), err);
286 }290 }
287291
288 /** @type {CommandLineArguments} */292 /** @type {CommandLineArguments} */