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

334635ce7487142699e31107201763557772f560

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

1 files changed, +5 -1Showing whitespace changes
src/command-line.js+5 -1
@@ -281,9 +281,13 @@ export class CommandLineParser {
281281 const dataRoot = isGlobal
282282 ? defaultConfig.dataRoot
283283 : (cliArguments.dataRoot ?? getConfigValue('dataRoot', defaultConfig.dataRoot));
284- if (isGlobal && !fs.existsSync(dataRoot)) {
284+ try {
285+ if (!fs.existsSync(dataRoot)) {
285286 fs.mkdirSync(dataRoot, { recursive: true });
286287 }
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);
290+ }
287291
288292 /** @type {CommandLineArguments} */
289293 const result = {