Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Change file name adapter so it runs on directories. #119

Description

@Katsute

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
return file;

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);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions