Write node-webkit file to folder within UserFolder

Get help using Construct 2

Post » Mon Oct 28, 2013 12:29 pm

Hi, I'm wondering if it's possible to create a new folder within the UserFolder directory to write node-webkit files to. The main reason is that I don't want game files to be in the same directory as random documents without sub-folders, as this can easily lead to accidental deletion by users.

Thanks!
B
11
S
3
Posts: 135
Reputation: 1,309

Post » Thu Nov 21, 2013 12:07 am

Just figured this out for myself. You need to use the create folder action for the node-webkit first before writing the file. You can't create a folder on the fly when trying to write the file.

So...

Event
Keyboard On S pressed


Action
1. Node-webkit Create folder NodeWebkit.UserFolder & "gamesubfolder"
2. Node-webkit Write "test" to file NodeWebkit.UserFolder & "gamesubfolder\myfile.txt"


The above will create a subfolder in the userfolder called "gamesubfolder" and will write the file "myfile.txt" in it with the content "test".



B
5
S
1
Posts: 8
Reputation: 491

Post » Thu Nov 21, 2013 12:19 pm

Aha! Works like a charm!

Thank you jambon, that's really helped a lot!
B
11
S
3
Posts: 135
Reputation: 1,309

Post » Wed Nov 19, 2014 2:58 pm

@jambon : can you tell me how to move a file to UserFolder? is it possible? thanks
B
58
S
13
G
5
Posts: 101
Reputation: 7,547


Return to How do I....?

Who is online

Users browsing this forum: Blendi1223, kellehk, TRMG and 27 guests