File::revealToUser() reveals the parent dir

For some reason, at least on Mac, using revealToUser() shows the parent dir instead of the directory itself.

auto f = juce::File::getSpecialLocation(juce::File::userDocumentsDirectory);
f.revealToUser();

Opens the user home directory:

Instead of the expected, contents of the folder:

Could that be looked at? If changing it breaks some expected behavior, a flag to force the real directory contents would be very much appreciated.

Eyal

It breaks code and has been for years now.

I guess you’re looking to use:

startAsProcess();

Instead.

3 Likes

The same thing happens in Terminal if you cd path and then type open .
the parent folder is opened and the folder is selected. It’s really annoying.
I think this is a MacOS issue, not a JUCE issue.

I think it is a misunderstanding:
My understanding of revealToUser is show this file (or folder) in the finder. So it will open the containing folder and select/highlight the file it was called on.

The docs for revealToUser() are actually clear:

Opens Finder, Explorer, or whatever the OS uses, to show the user this file’s location.

Actually on my machine (intel iMac, Big Sur) it doesn’t work that way.

I did:

cd ~/Documents
open .

And it opened the contents of the document folder, as expected…

That works super well! Thanks! Will that work the same way in Windows?

2 Likes

I’m pretty sure it does. I use it for preset managers to show the presets folder. (Tested it a while ago but sure I’ve tested windows too)

2 Likes

I shall retest. Perhaps I’m thinking of another program that has the same ‘reveal in finder’ problem.

You are both right, it depends which ‘view’ option you have in the finder (list vs columns)

4 Likes

Today I Learned!!