Skip to content

Commit

Permalink
improve copy directory
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Feb 6, 2024
1 parent 60ffa77 commit 7aed300
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/tbox/platform/windows/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,10 @@ tb_bool_t tb_file_copy(tb_char_t const* path, tb_char_t const* dest, tb_size_t f
tb_file_mkdir(full1);
tb_trace_i("tb_file_copy link: %s %s", path, dest);
if (tb_kernel32()->CopyFileExW && tb_kernel32()->CopyFileExW(full0, full1, tb_null, tb_null, FALSE, COPY_FILE_COPY_SYMLINK))
{
tb_trace_i("copy link ok");
return tb_true;
}
tb_trace_i("copy file content");
// we should read file content to copy it
tb_bool_t ok = tb_false;
Expand All @@ -471,9 +474,11 @@ tb_bool_t tb_file_copy(tb_char_t const* path, tb_char_t const* dest, tb_size_t f
return ok;
}

tb_trace_i("CopyFile: %s", path);
// copy it
if (!CopyFileW(full0, full1, FALSE))
{
tb_trace_i("CopyFile2: %s", path);
tb_file_mkdir(full1);
return (tb_bool_t)CopyFileW(full0, full1, FALSE);
}
Expand Down

0 comments on commit 7aed300

Please sign in to comment.