Node-Webkit AppFolder bug

0 favourites
  • 11 posts
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • 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

    [attachment=0:2qceskxz][/attachment:2qceskxz]

    Description of Capx

    This attempts to open "construct2.png".

    Steps to Reproduce Bug

    • 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
      • Node-Webkit Operating System and Service Pack Windows 8.1 Construct 2 Version ID r175
  • GeometriX

    The parameter box for 'RunFile' states you should use double-quotes, so not a bug.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • In that case, you should use """&NodeWebkit.appfolder&""" (or something alike)?

    Seems like a pretty big trap IMO since the expression is here.

    zenox98

  • 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 .

  • Sincere apologies. Missed the 'NodeWebkit.AppFolder' part.

  • 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.

  • 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.

  • The thing is you are setting some " around the expression's value

  • 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.

  • 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.

  • Oooooooh, okay, that makes total sense now. The quotation marks in the beginning are plain text, hence the & to connect them.

    Thanks for clearing that up!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)