-1
I have a simple function to search a file in the application directory and return it, however the return is always being empty, I could not find where the error is.
Path currentRelativePath = Paths.get("");
String url = currentRelativePath.toAbsolutePath().toString() + "/uploads";
File dir = new File(url);
//pego o caminho atual e concateno com a pasta que quero, onde está o arquivo txt.
File[] matches = dir.listFiles(new FilenameFilter()
{
public boolean accept(File dir, String name)
{
//return name.startsWith("file") && name.endsWith(".txt");
return name.equals("file.txt");
//nenhuma das opções de retorno encontra arquivos.
}
});
I appreciate contributions.
Hello, put the code in the answer and not the image. This way does not make it easy for other users to test your code.
– renanvm
It worked perfectly, thank you !
– Sabrina