Skip to content

Commit

Permalink
add overwrite confirm required flag
Browse files Browse the repository at this point in the history
  • Loading branch information
YuHsuan-Hwang committed Jul 26, 2024
1 parent f8c61fa commit 8675a47
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Frame/Frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1949,10 +1949,12 @@ void Frame::SaveFile(const std::string& root_folder, const CARTA::SaveFile& save
} else if (!overwrite) {
// Only overwrite file or symlink with confirmation
message = "Cannot overwrite existing file or symlink.";
save_file_ack.set_overwrite_confirmation_required(true);
}
} else if (!overwrite) {
// Only overwrite image with confirmation
message = "Cannot overwrite existing image.";
save_file_ack.set_overwrite_confirmation_required(true);
}

if (!message.empty()) {
Expand Down
1 change: 1 addition & 0 deletions src/Region/RegionHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ void RegionHandler::ExportRegion(int file_id, std::shared_ptr<Frame> frame, CART
message = "Export region failed: existing path is not a file.";
} else if (!overwrite) {
message = "Export region failed: cannot overwrite existing file.";
export_ack.set_overwrite_confirmation_required(true);
} else if (!export_file.isWritable()) {
message = "Export region failed: cannot overwrite read-only file.";
}
Expand Down

0 comments on commit 8675a47

Please sign in to comment.