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 directories to be used to fill filelist #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

allow directories to be used to fill filelist #74

wants to merge 1 commit into from

Conversation

Cerbis
Copy link

@Cerbis Cerbis commented Sep 4, 2020

This change allows also to pass directories to the cli. It makes it simpler to add multiple files.

@Cerbis Cerbis changed the title allow directories to be used as filelist allow directories to be used to fill filelist Sep 4, 2020
@developersu
Copy link
Owner

Could you please update it by adding split-files support?

Your construction that replaces

if (file.exists())
filesList.add(file);
doesn't cover this case, however in UI (and in CLI) users can select split-files.

Please feel free to tell you thoughts.

Thanks!

@developersu developersu self-assigned this Sep 5, 2020
@Cerbis
Copy link
Author

Cerbis commented Sep 6, 2020

If it's okay for you, i would like to keep the change like that.
The only change is that a user can also pass a directory instead of files only, the behavior stays the same.

I'm not familiar with the split-files support (and were it happens), so if the current change doesn't break anything i would like to leave it for another merge request.

@developersu
Copy link
Owner

It breaks this function because it's possible to set slit-files (that are folder) as an input value.

For each of USB-related transfer methods such validation implemented here (extends this class)

For Net-transfers it's here:

private void validateFiles(List<File> filesList) {
filesList.removeIf(f -> {
if (f.isFile())
return false;
File[] subFiles = f.listFiles((file, name) -> name.matches("[0-9]{2}"));
if (subFiles == null || subFiles.length == 0) {
logPrinter.print("NET: Exclude folder: " + f.getName(), EMsgType.WARNING);
return true;
}
Arrays.sort(subFiles, Comparator.comparingInt(file -> Integer.parseInt(file.getName())));
for (int i = subFiles.length - 2; i > 0 ; i--){
if (subFiles[i].length() < subFiles[i-1].length()) {
logPrinter.print("NET: Exclude split file: "+f.getName()+
"\n Chunk sizes of the split file are not the same, but has to be.", EMsgType.WARNING);
return true;
}
}
return false;
});
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants