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(); 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)); })