File::getSpecialFileLocation() returns weird folder

Dear all,

I have a problem with the static File::getSpecialFileLocation() function, where it returns a weird, temporary looking filepath instead of the desired folder. It is probably an easy to fix issue or I’m not understanding the File-functions correctly :slight_smile:

I’m using File::SpecialLocationType::currentApplicationFile() to return the folder where my application is in:

File::getSpecialLocation(File::SpecialLocationType::currentApplicationFile).getParentDirectory().getFullPathName();

Using this on my machine (where I compile it) works all fine, windows and mac, always returns the correct folder. On some other machines this works fine aswell, but on some machines it returns something like this:

/private/var/folders/5x/hnskmlns52zc3r73hp6wqxmm0000gn/T/AppTranslocation/3AA6D117-2F80-49F5-BF02-9E1C11F9FD1A/d/projects/

This looks like some weird temporary folder to me, which XCode / VisualStudio uses?

If i recompile it on one of those machines, it works there aswell. Feels like the path is “printed” in during compilation, but this couldn’t be it I guess?

Anyone any idea what I might be doing wrong?

Thanks in advance!

Looks like a case of App Translocation. I was not even aware it existed, but:

Starting with macOS Sierra, running a newly-downloaded app from a disk image, archive, or the Downloads directory will cause Gatekeeper to isolate that app at a unspecified read-only location in the filesystem. This will prevent the app from accessing code or content using relative paths.

It’s a security feature, some more details here: App Translocation

1 Like

Thanks very much!

That makes sense , I will have a look :slight_smile: