get list of files in the files folder

For developers using the Construct 2 Javascript SDK

Post » Tue Jun 17, 2014 3:39 am

Is there any way to get a list/string of all the files a user has added in the files folder (at runtime)? If not could i request something like this be added @Ashley, an array of the filenames or something would make automatic loading operations easier so users didn't have to go through a big fuss of specifying files to load if a plugin requires them for whatever purpose.
B
75
S
13
G
8
Posts: 1,973
Reputation: 9,841

Post » Mon Aug 11, 2014 12:51 am

I'm seeking a similar answer. I want to use a list of audio files in a specific directory that's part of the project. However on export I believe all the files are pulled to a root rather than maintaining a folder structure( I believe). So being able to grab the file names during edit time by use of knowing the folder would be fantastic.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,013

Post » Mon Aug 11, 2014 1:21 am

@jayderyu Yeah Ashley said in a thread or manual i cannot remember but the Folders you make in Construct 2 is just for organizing while making the game, On export the files are put into a root!

@QuaziGNRLnose Are you talking about how it changes the file name when you import files into C2? If so yeah that would be nice to have the original filename.
B
16
S
2
Posts: 34
Reputation: 914

Post » Mon Aug 11, 2014 2:25 pm

@SHG
Yep that's what I knew. What I wanted to know is getting the file list from a folder during edit mode for use during runtime. However that was the past tense and I'm not working around that. Though heavier it's a more robust solutionl
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,013

Post » Wed Aug 13, 2014 1:23 am

@SHG

No, i'm asking if theres a way to get a list of all the files which have been imported through construct, so that i can scan for certain extensions and load them upon detection instead of forcing users to specify they want to load them, literally just a comma separated string with file-names would be sufficient.
B
75
S
13
G
8
Posts: 1,973
Reputation: 9,841

Post » Wed Aug 13, 2014 12:24 pm

No, it's not supported, but it's what the project file parameter is for.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240

Post » Wed Aug 13, 2014 5:27 pm

Ashley wrote:No, it's not supported, but it's what the project file parameter is for.


What is the project file parameter ? i didn't find it documented or didn't notice it when looking through preview.js.

Some type of support for affecting the pre-loader for pre-processing work would be nice. At the moment the support for loading only audio and image leads to problems where plugins that have to do different types of loading are left to load after the game has "loaded". It'd be nice to make loading work for all plugins the way it only does or some.
B
75
S
13
G
8
Posts: 1,973
Reputation: 9,841

Post » Wed Aug 13, 2014 5:39 pm

I think he means AddFileParam("File", "Select a project file to request."); Check the Ajax plugin.

Edit :
I'm facing a similar problem, I want to include a folder with the dependency key in edittime.js and it only seems to work with individual files :cry:
B
10
S
2
G
1
Posts: 202
Reputation: 1,545

Post » Wed Aug 13, 2014 8:09 pm

That's not really at all what i need, as this still requires the user to specify a file manually, which i rather have loaded automatically.
B
75
S
13
G
8
Posts: 1,973
Reputation: 9,841

Post » Thu Aug 14, 2014 8:43 pm

Well, there no way to support it with Javascript for security reasons but node-webkit so can do everything for file system.
B
97
S
35
G
29
Posts: 3,139
Reputation: 28,361

Next

Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests