Node-Webkit AppFolder bug

Bugs will be moved here once resolved.

Post » Thu Sep 04, 2014 8:48 am

Problem Description
When trying to run a file using the NodeWebkit.AppFolder&"something.xxx" expression, the action doesn't run if the game exe is in a folder whose directory structure contains spaces.

Attach a Capx
NW bug.capx


Description of Capx
This attempts to open "construct2.png".

Steps to Reproduce Bug
[list]
[*] 1) Run the capx and export to NW.
[*] 2) Copy construct2.png from the C2 folder (this is just an example, it'll work with any file), into the exported folder.
[*] 3) Copy the NW folder to any HDD root.
[*] 4) Rename the NW folder to something with a space in it (like "win 32").
[*] 5) Run the exe, click the button and watch as nothing happens.
[*] 6) Now rename the NW folder back to "win32" or whatever.
[*] 7) Run the exe again, click the button and watch as the png opens.

Observed Result
The png doesn't open when in a folder with a space.

Expected Result
The png should open

Affected Browsers
[list]
[*] Node-Webkit

Operating System and Service Pack
Windows 8.1

Construct 2 Version ID
r175
You do not have the required permissions to view the files attached to this post.
B
57
S
15
G
11
Posts: 912
Reputation: 12,606

Post » Thu Sep 04, 2014 9:04 am

@GeometriX
The parameter box for 'RunFile' states you should use double-quotes, so not a bug.
You do not have the required permissions to view the files attached to this post.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
86
Posts: 5,418
Reputation: 59,522

Post » Thu Sep 04, 2014 9:15 am

In that case, you should use """&NodeWebkit.appfolder&""" (or something alike)?
Seems like a pretty big trap IMO since the expression is here.

@zenox98
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Thu Sep 04, 2014 10:26 am

@zenox98, again, I am not referring to a static file location. I'm using the expression NodeWebkit.AppFolder. That should not be in quotation marks .
B
57
S
15
G
11
Posts: 912
Reputation: 12,606

Post » Thu Sep 04, 2014 1:09 pm

Sincere apologies. Missed the 'NodeWebkit.AppFolder' part.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
86
Posts: 5,418
Reputation: 59,522

Post » Thu Sep 04, 2014 4:45 pm

I don't see a bug here. The AppFolder expression is not an exception to the requirement (that comes from the OS) that paths with spaces in them must be wrapped in double quotes. So you need to use an expression like:

"""" & NodeWebkit.AppFolder & "something.xxx"""

Also note your .capx has a redundant backslash, so tries to open a path ending in "win32\\construct2.png" which might also break it.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,600

Post » Thu Sep 04, 2014 7:49 pm

@Ashley, thanks, in that exact configuration, it works. Any idea why that preceding "&" is required? The whole thing seems kind of counter-intuitive to me.
B
57
S
15
G
11
Posts: 912
Reputation: 12,606

Post » Thu Sep 04, 2014 7:58 pm

The thing is you are setting some " around the expression's value
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Thu Sep 04, 2014 8:07 pm

For sure, I understand its purpose, but it seems counter-intuitive in the sense that I'd expect the plugin to fully parse the expression to NW, without having to be babysat like this. I can't think of another example where this extra extra set of quotations is required in Construct.
B
57
S
15
G
11
Posts: 912
Reputation: 12,606

Post » Thu Sep 04, 2014 8:12 pm

@GeometriX - it works like this:

Firstly "" inside a quoted string is actually read as a single " in the output string. For example the expression text

"Here's a quote: "" <-- there it is"

outputs

Here's a quote: " <-- there it is

By using two "" it inserts a double quote instead of being the " that ends the string.

So a string containing just a double quote is " "" ", or without spaces, four double quotes: """"

Add to that the app folder, then add the filename, which also has a quote at the end, e.g. "something.xxx"" ", or without the space, "something.xxx""".

So you have an expression

"""" & NodeWebkit.AppFolder & "something.xxx"""

that actually outputs a string like

"C:\some\path\something.xxx"

or, just a normal path wrapped in double-quotes, which is what the OS needs to handle paths with spaces.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,600

Next

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest