Skip to content

Commit

Permalink
Merge pull request #16711 from Nexus-Mods/16710-fixed-directory-recur…
Browse files Browse the repository at this point in the history
…sive-creation

fixed recursive folder creation during staging path transfer
  • Loading branch information
insomnious authored Dec 12, 2024
2 parents 6af8969 + 45c980e commit d00d932
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions __tests__/util.transferpath.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/util/transferPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
})
Expand Down

0 comments on commit d00d932

Please sign in to comment.