Access Resource Files

Klaus major-k klaus at major-k.de
Fri Sep 20 05:52:38 EDT 2019


Hi JB,

> Am 20.09.2019 um 11:45 schrieb JB via use-livecode <use-livecode at lists.runrev.com>:
> 
> Hi Klaus,
> 
> That worked but the file that appeared on the desktop had
> no icon like was there before and the size is zero K.

hm, I have been working this way since the old Metacard days, so no idea what's wrong.
Did you use my exact syntax? If not, please post your code.

Did you create a standalone and added the pic via "Copy files"?

> JB
> 
> 
>> On Sep 20, 2019, at 2:30 AM, Klaus major-k via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>> Hi JB,
>> 
>>> Am 20.09.2019 um 11:11 schrieb JB via use-livecode <use-livecode at lists.runrev.com>:
>>> 
>>> 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 X-82.app/Contents/Resources/myPic.jpg
>>> put dirName & "/Buss X-82.app/Contents/Resources/myPic.jpg/" 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
>> ...

Best

Klaus

--
Klaus Major
https://www.major-k.de
klaus at major-k.de





More information about the use-livecode mailing list