Skip to content

Commit

Permalink
more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnrushefsky committed Sep 24, 2024
1 parent 24fd4f8 commit 887debc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,15 @@ async function main() {
const newDir = `${path.resolve(syncConfig.local_path)}-${work.id}`;
log.info(`Moving ${syncConfig.local_path} to ${newDir} for upload`);
try {
/**
* Try moving the folder, because it's faster than copying.
*/
await fs.rename(syncConfig.local_path, newDir);
} catch (e: any) {
/**
* If the move fails, it's likely due to a cross-device link error,
* so we should copy the folder instead.
*/
if (e.code && e.code === "EXDEV") {
log.warn(
`Cannot move ${syncConfig.local_path} to ${newDir} due to cross-device link, copying instead`
Expand Down

0 comments on commit 887debc

Please sign in to comment.