Hi,
I have multiple projects that will share part of the resources: instead of copying multiple copies of the same resources in several assets/gfx folders, specified in project.xml like this
<assets path="assets/gfx" />
I’d like to specify an upper level folder like this
<assets path="../commonRes/gfx" />
Is this possible? I already tried to do this, but preloader stops loading at about 95%, in the console (Chrome) I read
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:2000/commonRes/gfx/aniBG_.jpg
EDIT: ok, locally I can’t have a folder level upon root, trying a different strategy…
Make a folder with your shared assets, make an “include.xml” file with relative paths to any assets you want in your shared stuff.
In your project, use an <include /> tag with the path to your shared directory, or the include.xml file directly. The tools will find the include.xml file and pull in the defines, haxelibs, assets and other things you put in your shared location
It works!
But… how the h**l does it find the shared folder even if I change the level of the complied folder path?! It is like magic, unless I missed something…
Well, when it compiles, it copies the files into your Export directory, just as it would ordinarily. It just uses your shared XML file, so you don’t have to copy and paste all that stuff into all your project files
Oh s**t! I didn’t notice it (because the shared assets have the same folder structure of the local ones): no good, I have to share the same folder, not the same assets doplicated for each project!
I’m not quite sure if the tools would be alright with this. You could also copy files yourself, and use Loader manually (like the good 'ole Flash days)
For now I am going to stay with the duplicated assets, they are just XML files and shouldn’t take much space on the server, I just need to update all of them each time I update the compiled projects on it.
Revive!
Now I am trying to use both shared assets and local assets, and I’d like to overwrite the shared ones with local ones, if they have the same name.
I thought this would write SharedAssets/Audio_XXX to Assets/Audio, and then Assets/Audio_XXX to the same folder Assets/Audio, overwriting files with the same name.
What I find instead are the files from SharedAssets/Audio_XXX folder, so the possibilities are two:
Disabling include/shared paths I confirm files copy correctly. I also checked the files date: Assets files are newer than include/shared ones, but they are not overwritten over the shared ones.
Xml lines order is usually meaningless, so I think that include/shared tags are always processed before or after assets ones, anyway if it is true that the compiler keeps the newer files, how comes I have older versions of files that are in both include/shared and assets paths?
i.e.:
Assets/Audio (assets path) contains
file1.ogg, 4-3-2015
file2.ogg, 11-11-2015
SharedAssets/Audio (include path) contains
file2.ogg, 9-9-2015
I will obtain
Assets/Audio containing
file1.ogg, 4-3-2015
file2.ogg, 9-9-12015
It would really help knowing if include paths are processed before or after assets ones: the test suggests that the order in the xml is not relevant, as I obtain the same result by setting both assets/include and include/assets order.
The XML processes down the list, but copies only on the “update” step after processing the project completely. Update currently uses “file is newer” logic. Perhaps we could disable this, though I assume it helps with performance when there are a lot of files?