How do I Keep NW.js File Resource Paths?

Get help using Construct 2

Post » Fri Jan 29, 2016 7:38 pm

Hello! My current problem is that I have multiple files that I will be dynamically loading into my project at runtime that all have the same name, but are in specified paths to differentiate what 'model' they are for. In Construct, I know I'm able to import files and put them in their own folder inside the project tree, though to reference them I have to only specify the file name to access it regardless of where it's located. For most of my files, this is perfectly fine. When I export the project through the Node Webkit all of those files are jammed into the same archive (package.nw) in the same root directory. The problem with the other files though, is that the other files I need to include require their own paths so placing them all inside the same folder is not viable. Short of renaming the package to a zip and manually creating the path structure and placing the files inside or simply placing them externally, is there a way that I can preserve the folders/paths I use in the project when exported into the Node Webkit package?

(I'm currently making my own plugin using a 3rd-party framework so unfortunately just renaming the files to make them unique is currently not viable :c )
B
4
Posts: 2
Reputation: 204

Post » Fri Jan 29, 2016 8:48 pm

Placing them in the app directory by hand and using the appfolder expression of nwjs in combination with the subdirectory path should be able to lead you to different subdirectories in your app path.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Fri Jan 29, 2016 9:49 pm

That was definitely one of the alternatives I've considered, though to test any changes I've made I would have to re-export the project each time and run the application. The reason I want to include everything into the project itself so I can simply edit the framework to reference the local files and then be able to use the Preview functionality of C2 to debug and test changes and later export it through NW. I'm not able to use the AJAX plugin to load each and every file the framework will reference later on, and the files can't be outside of the project either :(
B
4
Posts: 2
Reputation: 204

Post » Fri Jan 29, 2016 11:25 pm

I also think it is pretty bad that project files don't have any real folder structure...

But what you can do (for developing / testing via preview mode):

Use a variable called folder or something. For exporting you will set it to nwjs.appfolder, but for development, you set it to your harddrive folder containing the folder with your assets. Make sure to use nw.js for preview, though!
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786


Return to How do I....?

Who is online

Users browsing this forum: tarek2, theinfomaven and 8 guests