in NongAddPopup::addLocalSong the code attempts to copy songPath into destination, so it fails when they are pointing to the same file. They are pointing to the same file when editing a local song.
The code fails because:
It attempts to delete destination and copy songPath into it. But when they are the same file then songPath is also deleted.
The copy function doesn't allow both inputs to point to the same file
The fix is checking with std::filesystem::path::compare if they are the same path. If it is the same path, then skip copying.
Also, I replaced the "exists then remove" with the copy option: std::filesystem::copy_options::overwrite_existing.
And removed the std::string error = ""; line. I think it's useless
in
NongAddPopup::addLocalSong
the code attempts to copysongPath
intodestination
, so it fails when they are pointing to the same file. They are pointing to the same file when editing a local song.The code fails because:
The fix is checking with
std::filesystem::path::compare
if they are the same path. If it is the same path, then skip copying.Also, I replaced the "
exists
thenremove
" with the copy option:std::filesystem::copy_options::overwrite_existing
.And removed the
std::string error = "";
line. I think it's useless