I need help with Security Scoped Bookmarks

[quote=79700:@Thomas Tempelmann]Mike,
Pleaase note that there is no “Mac OS Lib”. There is, however, a “macoslib” (or MacOSLib).

Also, I believe you have a coding error here:

#if TargetCocoa then

That should be:

#if TargetCocoa = true then

or, even better:

#if (TargetCocoa = true) = true then

You can never use too many of those boolean tests!

And I see that you stay away from using the not operator, that’s good. Nobody want to see things like this:

if not (fAfter.exists = true) then

(sorry, couldn’t resist)[/quote]
Thomas

This is interesting. I was taught that

#if TargetCocoa then

or

#if not TargetCocoa

was the correct syntax.

I use this syntax exclusively in my programs and they work fine. In fact, when I see a “if bval = true then” I find it very odd.

Out of interest, why do you think you should use this syntax and why not use an “if not … then” syntax?

@Simon: Thomas was funning you.

Yeah, I was making fun of the fact that many Xojo programmers write

if valid = true the if valid = false then
instead of just

if isValid then if not isValid then

I see this only with Xojo programmers, and I wonder how this started and how it keeps spreading. I guess that someone started giving these bad examples and everyone else picks them up.

But I also realize that this is off-topic here, and I’ll shut up now.

I see it now.

Oops!

Hi Jim! Just wanted to say thanks for sharing this. I’ve been looking for a solution to allow persistent access to a folder outside my apps sandbox and this does the trick. I only wish I had found it sooner!

I got the bookmarktest app.
It worked for files but not to bookmark a folder…

Also I need to know if the scoped bookmark can grant access also to files and subfolders.

Can oanyone put me on the right way ?
Thanks