Access Resource Files

Klaus major-k klaus at
Fri Sep 20 05:30:21 EDT 2019

Hi JB,

> Am 20.09.2019 um 11:11 schrieb JB via use-livecode <use-livecode at>:
> Hi Klaus,
> Thanks for the info!  A file path alone does not work for me.
> Here is what I have tried.
> In the Stack Script;
> global dirName
> on openStack
>   put the defaultFolder into dirName
> end openStack
> —From a button on a card;
> global dirName
> on mouseUp
>  --/Users/JB/Desktop/Buss X-82/Buss
>  put dirName & "/Buss" into fPath
>  put fPath
> end mouseUp
> That is how I can get a file path but using this path will not work if the path
> directs to a bundle but it will work if the file is not in a bundle.

that's why LC gave us the specialfolderpath() codes! 
No need to mess around with DEFAULTFOLDER etc. on different platforms anymore.
Especially if Apple likes to change things out of a sudden again! :-D

> That being said how do I go about copying this file with specialfolderpath() ?

See below...

> Do I need to go to the standalone settings and add the file using copy files
> section and then from within my app I can copy that file

Yes, that's the way you should work.

> but if I add it my self after the .app is made I will not be able to copy it?

specialfolderpath("resources") will also work IF you copy your files 
to the correct folder inside of the APP package.

> Are you saying this will return the path to my resource in my app and let
> me copy it to the desktop?  Do you have some more examples of copying
> the file with this procedure?
## Copy your pic inside of the APP package to the Desktop folder:
put specialfolderpath("desktop") & "/mypic.jpg" into tTargetFile
put specialfolderpath("resources") & "/mypic.jpg" into tSourceFile
if there is not a file tTargetfile then
  put url("binfile:" & tSourceFile) into url("binfile:" & tTargetFile)
end if

> JB



Klaus Major
klaus at

More information about the use-livecode mailing list