| 281 | 281 | const dataRoot = isGlobal |
| 282 | 282 | ? defaultConfig.dataRoot |
| 283 | 283 | : (cliArguments.dataRoot ?? getConfigValue('dataRoot', defaultConfig.dataRoot)); |
| 284 | | - if (isGlobal && !fs.existsSync(dataRoot)) { |
| 284 | + try { |
| 285 | + if (!fs.existsSync(dataRoot)) { |
| 285 | 286 | fs.mkdirSync(dataRoot, { recursive: true }); |
| 286 | 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); |
| 290 | + } |
| 287 | 291 | |
| 288 | 292 | /** @type {CommandLineArguments} */ |
| 289 | 293 | const result = { |