From 8c6291520ded4af3c10c4f573d2b04d7d22ad2d4 Mon Sep 17 00:00:00 2001 From: IDCs Date: Thu, 28 Nov 2024 07:24:21 +0000 Subject: [PATCH 1/2] fixed recursive folder creation during staging path transfer fs-extra's recursive directory creation is not reliable; now using fs.ensureDirWritableAsync which is "battle" proven. fixes nexus-mods/vortex#16710 --- src/util/transferPath.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/transferPath.ts b/src/util/transferPath.ts index 4ddfe937e..1564ed707 100644 --- a/src/util/transferPath.ts +++ b/src/util/transferPath.ts @@ -168,7 +168,7 @@ export function transferPath(source: string, const destPath = path.join(dest, path.relative(source, entry.filePath)); return isCancelled ? Promise.reject(new UserCanceled()) - : fs.mkdirsAsync(destPath).catch(err => (err.code === 'EEXIST') + : fs.ensureDirWritableAsync(destPath).catch(err => (err.code === 'EEXIST') ? Promise.resolve() : Promise.reject(err)); }) From 45c980eebd782e164a03ef401a62614511d5d079 Mon Sep 17 00:00:00 2001 From: IDCs Date: Thu, 28 Nov 2024 08:11:34 +0000 Subject: [PATCH 2/2] adding unit test for transferpath --- __tests__/util.transferpath.test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/__tests__/util.transferpath.test.js b/__tests__/util.transferpath.test.js index 112270422..b0b46f7e9 100644 --- a/__tests__/util.transferpath.test.js +++ b/__tests__/util.transferpath.test.js @@ -84,6 +84,10 @@ jest.mock('../src/util/fs', () => { size: 0, }); }, + ensureDirWritableAsync: jest.fn((dirPath) => { + insert(dirPath, { }); + return Promise.resolve(); + }), mkdirsAsync: jest.fn(dirPath => { insert(dirPath, { }); return Promise.resolve();