Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cross-drive moving #298

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions lib/moving.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,16 @@ Stream<int> moveFiles(
moveFile() async {
final freeFile = findNotExistingName(
File(p.join(folder.path, p.basename(file.value.path))));
try {
return copy
? await file.value.copy(freeFile.path)
: await file.value.rename(freeFile.path);
} on FileSystemException {
print(
"Uh-uh, it looks like you selected other output drive than\n"
"input one - gpth can't move files between them. But, you don't have\n"
"to do this! Gpth *moves* files, so this doesn't take any extra space!\n"
"Please run again and select different output location <3",
);
quit(1);
if (copy) {
return await file.value.copy(freeFile.path);
} else {
try {
return await file.value.rename(freeFile.path);
} on FileSystemException {
var temp = await file.value.copy(freeFile.path);
await file.value.delete();
return temp;
}
}
}

Expand Down