MRUF and Translocation

MRUF (most recently used files) is a concept that we have all grown to rely on… where an app remembers the last “x” files you used and gives you one-click access to them at a future date.

There have been discussions here about how “sandboxing” an app, creates issues, and there were discussions about “Security Bookmarks” (or bodgemarks as Sam put it)… but no real workaround (or at least none with working code samples)

Now I guess that even if you don’t “sandbox” and just run the app under HighSierra, that translocation imposes the same restriction, in that you cannnot access a file without going through the Open Dialog to give explicit permission.

Does anyone have a code example (declares accepted) that allow an app to open a file where the path was stored in a previous session?
Otherwise I have to remove this feature, and that isn’t something I want to do.

App translocation makes the app appear on a virtual location. This is for files next to the app but shouldn’t affect files in the documents folder for example.

Why do you worry about app translocation?

Because Translocation doesn’t seem to allow me to access files that are NOT “next to the app”
If the user decides to create a folder on his file system (at their discretion), and my app stores the path in a file
then later my app crashes if it tries to open that file

dim filepath as "disk3/fred/barney/mytext.txt"
dim txt as textinputstream
txt=textinputstream.open(getfolder(filepath))

So I worry about anything that keeps my app from working as it is expected to

Yes, it does.

I don’t.

But since you’re not Sandboxing your app, just make sure it doesn’t get Translocated (I know, if it weren’t for some macOS Bugs, this wouldn’t be an issue).
Meaning: Distribute a signed app in a (signed) .dmg.

That way the user has to move your app, and Translocation is (should be - sometimes macOS does weird things) a non-issue.

Or in case you don’t find the file you need (and you detect that your app is translocated): Inform the user about Translocation. Well, better do that always (before they start creating files) - I guess. Workaround is as simple as: move app to Desktop and back again. Just move it at least once.

Based on feedback from several other users (some Xojo developers, and some not).
The app will detect if it has been translocated and inform the user to move it to /Applications

Production Deployment will be done via signed DMG, but during testing phase it is just a plain ZIP file

In my apps (even sandboxed ones) I use Jim McKay’s SSFolderitem class (jim@pidog.com).
It contains also a BookmarkTest.app to see it in action.