| 281 | const dataRoot = isGlobal | 281 | const dataRoot = isGlobal |
| 282 | ? defaultConfig.dataRoot | 282 | ? 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 | } |
| 287 | | 291 | |
| 288 | /** @type {CommandLineArguments} */ | 292 | /** @type {CommandLineArguments} */ |