On 7/16/2014, 4:27 PM, Scott Rossi wrote:

I've been using the function below to establish the custom folder as the
defaultFolder at startup, but it seems each time I run the simulator I get
a different result when checking the defaultFolder.

function resourcesPath
     put fileName of this stack into thePath
     set itemDel to "/"
     put "sections/" into last item of thePath
     return thePath
end resourcesPath


When building a standalone, I know the folder gets added to the
standalone's bundle.  So I'm trying to figure out how to best place the
"sections" folder in relation to the app, and set the defaultFolder
appropriately, so that the images in the folder can be accessed reliably
from desktop, mobile simulator, and standalone.

On mobile, copied files and folders are placed in a virtual location that need to be accessed using specialFolderPath("engine"). That will point to the same (virtual) place as your resourcesPath function. So on mobile, you need:

  put specialFolderPath("engine") & "/sections/" into thePath

You'll need to branch the code for desktop and mobile, because on desktop the special folder "engine" isn't the one where the stack lives. Use the resourcesPath logic for desktop.

The virtualization of paths on mobile is due to the sandboxing requirements on both iOS and Android.

--
Jacqueline Landman Gay         |     [email protected]
HyperActive Software           |     http://www.hyperactivesw.com

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

Reply via email to