yfoo Posted May 15, 2018 Posted May 15, 2018 If I wanted to put an asset in the resouce folder what is the proper approach to do so? Do I under onStart() download the asset into the resouce folder if it doesn't exist? Or is there a way to bake the asset into the jar itself? Thanks. 1
Eagle Scripts Posted May 15, 2018 Posted May 15, 2018 (edited) I would indeed go with a check in your onStart whether the resources already exist in the data folder or not. Do they? Load them locally. Don't they? Grab them from your/a server. Edited May 15, 2018 by Eagle Scripts
FrostBug Posted May 15, 2018 Posted May 15, 2018 With the new API introduced a few client versions back, the proper approach without downloading from the web would be: In the local script project: - Create a 'resources' package/folder in the root (not in a sub-package) - Put resource files in this folder - Get the resources using Script#getScriptResourceAsStream (provide relative path, eg. "resources/image.png") On the SDN: - Put the resources folder at the root level of your script directory > ScriptName --> src ----> scriptname.mainpackage --> resources ----> image.png ----> font.ttf 1
ThatGamerBlue Posted May 15, 2018 Posted May 15, 2018 - git root folder - scriptname1 - src - resources (for this script) - scriptname2 - src - resources (for this script) - resources (this is for all scripts)
Alek Posted May 15, 2018 Posted May 15, 2018 https://osbot.org/forum/topic/140803-local-and-sdn-resource-loading/ 1