Access Resource Files
JB
sundown at pacifier.com
Fri Sep 20 05:54:15 EDT 2019
I used your code as it was and changed the name of the file
to match your code.
I did not use Copy files and added it on my own after it
was built. I will try adding it to Copy files and see if that
makes a difference.
Thanks again!
JB
> On Sep 20, 2019, at 2:52 AM, Klaus major-k via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> 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
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list