Jacqueline,
Thank you very much! Your explanation will save me a load of time. There really 
ought to be a lesson on this, rather than making folks figure it out for 
themselves. It’s so simple, yet so time consuming to figure how to implement 
from the dictionary.

Best,
Bill

William A. Prothero, PhD
Prof Emeritus, Dept of Earth Science
University of California, Santa Barbara

> On Feb 5, 2022, at 12:05 PM, J. Landman Gay via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> On 2/5/22 12:21 AM, prothero--- via use-livecode wrote:
>> Ok, thinking….. so for development, I would need to do something like:
>> function resPath
>>     if the environment contains “Development” then
>>        put specialFolderPath("resources”)&”/mydataFolder" into dataPath
>>    else
>>        put 
>> specialFolderPath(“resources”)&”/dirSplashStackisin/pathToThisStack“&”/mydataFolder"
>>  into dataPath
>>    end if    
>>    return dataPath
>> end resPath
>> In other words, all app paths would be relative to the splash stack.
>> Is that right?
> 
> There are a couple of ways to handle this. One is by using the stackfiles and 
> the other is by creating a specific file path. In both cases, the module 
> stacks should be in a folder structure that lives in the same directory as 
> the splash stack; files scattered around the hard drive don't do well. You 
> can choose either method, you don't need both. Either method will work the 
> same way in the IDE and a standalone (including mobile.)
> 
> For stackfiles: when you enter the path to the file, use a path relative to 
> the main splash stack. The standalone builder retains the file structure when 
> it builds the app, so the relative file paths will be correct anywhere. Add 
> the entire folder of modules in Copy Files, you don't need to include 
> individual files. If you use this method, just refer to the module stack by 
> its short name.
> 
> For example, if your modules are inside a folder named "Resources" which 
> contains other folders, including a "FolderA":
>   Stack1      Resouces/FolderA/Stack1.livecode
> 
> When a script calls 'go stack "stack1"' LC will look at the stackfiles to get 
> the path. It's pretty easy to set up because the inspector includes a button 
> that lets you choose a stack and then fills out the correct path 
> automatically.
> 
> 
> For scripted paths: The specialFolderPath("resources") points to the folder 
> containing the stack that called it. What I usually do is write a filepath 
> function and put it into the splash's stack script. On startup I put the 
> splash in use so that all other stacks can see it.  All navigation goes 
> through this handler. Because it's in a single place, 
> specialFolderPath("resources") is always relative to the splash stack.
> 
> A very simplified example:
> 
> function getFilePath pFolder,pStack
>  -- pFolder can be a single folder or a path through more than one folder
>  if last char of pFolder <> slash then put slash after pFolder
>  put specialFolderPath("resouces") & slash & pFolder & pStack into tPath
>  put ".livecode" after tPath -- omit if you pass the extension in the pStack 
> parameter
>  return tPath
> end getFilePath
> 
> Call it like this:
> 
> put getFilePath("FolderA","Stack1.livecode") into tFilePath
> or:
> put getFilePath("FolderA/FolderB/FolderC","Stack1") into tFilePath
> 
> 
> -- 
> Jacqueline Landman Gay         |     jac...@hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to