Skip to content

Commit

Permalink
Move final file if in same file system, not only in same directory
Browse files Browse the repository at this point in the history
  • Loading branch information
aydreas committed Apr 21, 2021
1 parent ce6ccc2 commit 3c574f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ build
.mypy_cache
*.whl
venv
/.vs
4 changes: 3 additions & 1 deletion src/plotter_disk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ class DiskPlotter {
Timer copy;
do {
std::error_code ec;
if (tmp_2_filename.parent_path() == final_filename.parent_path()) {
bool same_filesystem =
fs::equivalent(tmp_2_filename.parent_path(), final_filename.parent_path(), ec);
if (ec.value() == 0 && same_filesystem) {
fs::rename(tmp_2_filename, final_filename, ec);
if (ec.value() != 0) {
std::cout << "Could not rename " << tmp_2_filename << " to " << final_filename
Expand Down

0 comments on commit 3c574f1

Please sign in to comment.