Change file name adapter so it runs on directories.
Katsute opened this issue · comments
Prerequisites
If all checks are not passed then the request will be closed.
- I have checked that no other similar feature request already exists.
- I have checked that this feature does not already exist.
- The feature request makes sense for the project.
Proposal
Describe the feature that should be added.
Change adapter so it runs on all files.
for(final File file : Objects.requireNonNullElse(parentFile.listFiles(), new File[0])){
- if(fileName.equals(file.isDirectory() ? file.getName() : adapter.getName(file))) // use adapter name only if not a directory
+ if(fileName.equals(adapter.getName(file))
return file;Reasoning
Explain why this feature should be added.
Developers may want to use adapter names against directories , specifically for checking within them (see https://github.com/Ktt-Development/webdir/pull/79).
If this change is made existing developers can simply use (below) to replicate the previous behavior.
@Override
public final String getName(final File file){
return file.isDirectory() ? file.getName() : super.getName(file);
}