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
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Thu Dec 10, 2015 9:31 pm

With which version of NW.js?
Image Image
B
25
S
14
G
136
Posts: 876
Reputation: 71,005

Post » Thu Dec 10, 2015 9:32 pm

Version 12. I'm holding off on 13 for just a little while longer.
B
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Thu Dec 10, 2015 9:34 pm

NW12 is functionnal with C2r216 maybe the path for textout.txt is wrong
Image Image
B
25
S
14
G
136
Posts: 876
Reputation: 71,005

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
39
S
16
G
6
Posts: 542
Reputation: 7,617

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
25
S
14
G
136
Posts: 876
Reputation: 71,005

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
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Thu Dec 10, 2015 10:13 pm

you're welcome
Image Image
B
25
S
14
G
136
Posts: 876
Reputation: 71,005


Return to How do I....?

Who is online

Users browsing this forum: luvleggs and 19 guests