Access Resource Files

Klaus major-k klaus at major-k.de
Fri Sep 20 13:45:01 EDT 2019


Hi JB,

> Am 20.09.2019 um 19:31 schrieb JB via use-livecode <use-livecode at lists.runrev.com>:
> 
> Thank you for the info.
> 
> I am using a earlier version and specialfolderpath("resources”) is not
> available

ah, yes, I saw that specialfolderpath() codes have been introduced in LC 1.1
but did no know that the RESOURCES folder came later.

> but specialfolderpath(“desktop”) and others are available.
> I don’t think it is possible without specific code written by those who
> made the app bundle.  Things like NSBundle etc seem to be built
> for use by the app developer and the links don’t work for others
> who are not accessing it at that level.

I think in older versions of LC the files got copied in to the same folder as the runtime,
so if -> specialfolderpath("engines") is already supported by your version of LC you 
could try that one:
...
put specialfolderpath("desktop") & "/mypic.jpg" into tTargetFile
put specialfolderpath("engine") & "/mypic.jpg" into tSourceFile
if there is not a file tTargetfile then
  put url("binfile:" & tSourceFile) into url("binfile:" & tTargetFile)
end if
...

If not supported, the you need to do it manually:
...
put specialfolderpath("desktop") & "/mypic.jpg" into tTargetFile

## This is the runtime:
put the effective filename of this stack into tSourceFile
set itemdel to "/"
put "mypic.jpg" into item -1 of tSourceFile
if there is not a file tTargetfile then
  put url("binfile:" & tSourceFile) into url("binfile:" & tTargetFile)
end if
...

You get the picture...

> thanks again,
> JB
> 
>> On Sep 20, 2019, at 10:10 AM, Niggemann, Bernd via use-livecode <use-livecode at lists.runrev.com> wrote:
>> answer specialfolderpath("resources")
>> ..
>> in the standalone and check if that is the folder you manually copied the file(s) to!
>> specialfolderpath("resources") was introduced in LC 6.7.5 (from the dictionary)

Which explains your empty dialog! :-)


Best

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





More information about the use-livecode mailing list