#Mac And Files In Java

1 messages · Page 1 of 1 (latest)

elder flame
#

Hi Guys I am testing a thing in my project and I am really confuse about a little thing, I didnt too much in mac, basically always in windows, and recently i was testing a thing with generative files. This thing check if a directory with the assertion of Junit, idk why when i pass a tmp directory generated by an annotation by Junit this make a temporary directory, thats works as expected, the problem comes, when the temporary directory is empty, and (I think) mac say "Oh this path with not extensions and no content its a file and obviously not is a directory" I am loosing my mind because i didnt found nothing on internet. Someone have the same problem at some point?

true totemBOT
#

<@&987246399047479336> please have a look, thanks.

true totemBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

limpid gorge
#

@elder flame can u post the code ? quite hard to have any idea on what's going on without that

elder flame
#

Mmm yes, give me a second

#

And if you give me a few mins i will put the codee without image

elder flame
#
final Path pathToTarget = Path.of(resultPath.toString(), "target");
final Path pathToTargetConsumer = pathToTarget.resolve(targetConsumer);
final File targetConsumerFolder = pathToTargetConsumer.toFile();

assertThat(targetConsumerFolder).isNotEmptyDirectory();```
true totemBOT
elder flame
#

The error:

Error: AsyncApiGeneratorTest.processFileSpecForTestFileGeneration:73 
Expecting file:
  /tmp/junit7678323192558060198/target/generated
 to be an existing directory.```
true totemBOT
high mulch
#

don't use legacy IO classes

#

if there is no API for Path objects, use assertTrue with Files.isDirectory

elder flame
#

The problem its Files.isDirectory keep saying a specific directory not is one

#

For that i want know how Java determine if its a directory or nnot

high mulch
elder flame
#

For example the path i post over

#

Its a directory, but the Files.isDirectory give me a false

#

When I pass him the File

#

idk why

high mulch
#

you can't pass a File into Files.isDirectory

#

also, the existense of a Path (or a File) java object doesn't mean that the directory/file is actually there