NWjs.ReadFile()

Get help using Construct 2

Post » Thu Dec 10, 2015 9:31 pm

Has anyone been able to get this to work? If I try this...

NWjs | Set 'testStr' to NWjs.ReadFile("sometext.txt")

NWjs | Write file 'testStr' to file "testOut.txt"

I get an empty text file written. Maybe I'm just using it wrong?
B
31
S
13
G
2
Posts: 490
Reputation: 5,011

Post » Thu Dec 10, 2015 9:31 pm

With which version of NW.js?
Image Image
B
19
S
10
G
116
Posts: 865
Reputation: 60,433

Post » Thu Dec 10, 2015 9:32 pm

Version 12. I'm holding off on 13 for just a little while longer.
B
31
S
13
G
2
Posts: 490
Reputation: 5,011

Post » Thu Dec 10, 2015 9:34 pm

NW12 is functionnal with C2r216 maybe the path for textout.txt is wrong
Image Image
B
19
S
10
G
116
Posts: 865
Reputation: 60,433

Post » Thu Dec 10, 2015 9:37 pm

Can't be. The file itself gets created, it's just that nothing is written to it, presumably because testStr itself is empty.
B
31
S
13
G
2
Posts: 490
Reputation: 5,011

Post » Thu Dec 10, 2015 9:50 pm

tested and all work as intended
create folder and file created with write function and append function....
I don't think you try to write in program files folder so your path for "sometext" is wrong or you miss something with event
Image Image
B
19
S
10
G
116
Posts: 865
Reputation: 60,433

Post » Thu Dec 10, 2015 10:04 pm

I made a silly mistake, forgot to add NWjs.AppFolder to the path :oops:

Thanks for the help :)
B
31
S
13
G
2
Posts: 490
Reputation: 5,011

Post » Thu Dec 10, 2015 10:13 pm

you're welcome
Image Image
B
19
S
10
G
116
Posts: 865
Reputation: 60,433


Return to How do I....?

Who is online

Users browsing this forum: DJKeefy, Momio, oddreal and 8 guests