NodeWebkit Relative Path

0 favourites
  • 8 posts
From the Asset Store
Ninja Pumpkin
$5 USD
50% off
Run, jump over or on enemies and reach the path’s end as fast as you can!
  • I have a file that I would like to manipulate using NodeWebkit, but I'm having problems finding the file when using a relative path.

    Example: I have a global variable (dataPath) with the path to the file and two events that display "True" if it can find the file or "False" if it can't.

    When dataPath is set to "C:\datafolder\file.txt", it displays "True".

    When dataPath is set to "..\datafolder\file.txt", it displays "False". (this is with the game files exported and running from C:\gamefolder)

    So my directories looks like this:

    C:\datafolder\file.txt
    C:\gamefolder\game.exe
    [/code:3bwsk6aq]
    
    Is there any reason this shouldn't work? What am I missing?
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you tried adding another ..

    "..\..\datafolder\file.txt"

  • I haven't, but I don't feel like that makes any more sense?

    ".." should go back one directory, right? So if I'm running the exe out of "C:\gamefolder", I would step back into "C:\", then up into "C:\datafolder". How would the extra ".." help?

    I'm away from my computer for now, but I suppose I'll try it later.

  • Try

    NWjs.AppFolder & "..\datafolder\file.txt"[/code:37abvqjg]
  • Ignore me, I was miss reading your original post.

  • Try

    NWjs.AppFolder & "..\datafolder\file.txt"[/code:1k7ep3ms]
    

    I'm fairly certain I tried that as well, but I'll give it another shot when I get home.

  • I tried this:

    NWjs.AppFolder & "..\datafolder\file.txt"[/code:1dexx9bm]
    
    And still no dice. I'm thinking I could probably work around it by saving that NWjs.AppFolder and stripping out the last foldername with tokenat, but I was hoping the tried and true ".." would work since it's obviously much less work. :/
  • It works for me. Have you got a "datafolder" folder created?

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