How do I Keep NW.js File Resource Paths?

0 favourites
  • 4 posts
From the Asset Store
Convert multiple Excel files into JSON files and import them into construct3.
  • 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 )

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)