Java on Macintosh directoryStream shows Applications as Folders

61 Views Asked by At

I feel like I must be missing something. It seems like this should be really easy but I can't seem to find an answer to this question.

I'm writing code in Java 8 using both

Files.newDirectoryStream()

class SimpleFileVisitor() {}

On a Macintosh (OSX 10.9.5) the Application Folder shows all the applications as a directory with a generated name and the code tells me it's a directory. I would like it to work like it does in the FileSelectDialog(). I am aware that under the hood and in the terminal applications really ARE just directories. The output to my code ends up looking like this.

enter image description here

I want to treat Applications like they do in the FileSelectDialog() and in the Mac Browser and have them looks like an application. Ie notice it's an application and treat it and is subdirectories & files as one application. But I can't figure out what I'm missing.

Default apdflckaaahabafndbhieahigkjhalf.app

Should look like

Google Drive.app

Would Files.isTraversable() help? I can just look for the .app extension but I'm not sure that is 100% reliable.

0

There are 0 best solutions below