Enhance file handling in list_files.js and patch_files.js by auto-creating chroot directories, improving path normalization, and refining error handling for file operations.
This commit is contained in:
@@ -132,9 +132,10 @@ export async function run(args) {
|
||||
let chrootResolved;
|
||||
try {
|
||||
chrootResolved = path.resolve(chrootPath);
|
||||
await fs.access(chrootResolved); // Ensure chroot path exists
|
||||
// Auto-create the chroot base directory if it does not exist
|
||||
await fs.mkdir(chrootResolved, { recursive: true });
|
||||
} catch (err) {
|
||||
return { err: `Invalid chroot path: ${chrootPath} (${err?.message || String(err)})` };
|
||||
return { err: `Failed to prepare chroot path: ${chrootPath} (${err?.message || String(err)})` };
|
||||
}
|
||||
|
||||
let resolvedBase;
|
||||
|
||||
Reference in New Issue
Block a user