[r202] Several folders bug v2

0 favourites
  • 5 posts
From the Asset Store
Several elements of the game interface hidden objects
  • Problem Description

    This is a remake of the other post since im not sure you read or reply to them, when they are in the closed bug section.

    So ill just focus on one of the problems.

    If you use NW.js open folder dialog you can select folder on your disk.

    Then you can use "List files from path "C:\Users\" etc.

    However if you use it with "On open folder dialog". Which would make sense since both functionalities are from NW.js you will notice that "List files from path" doesn't work with "Chosenpath" because when that is used with "Open folder dialog" it doesn't return the selected folder. Instead it return all files and sub folders that are in the selected folder.

    That means if you do something like this "List files from path = NWjs.Chosenpath" which would be the most logic thing to do. It doesn't work, because chosenpath returns everything in the folder including sub folder names, but not the selected folder. If you choose an empty folder for instant it doesn't return anything at all. Making "Open folder dialog", "List files from path" and "Chosenpath" not compatible.

    It works in different ways depending on, how you use "List files from path" which complicate the explanation a bit.


    1. If the folder selected is empty, meaning no files in it. It doesn't return the folder name as expected. It will return nothing.

    2. If there are files in the folder it doesn't return the folder name, but instead it returns the file names and sub folder names of all the folders in the selected one, under one condition that there are files in the sub folder, those sub folders where there are no files are not returned.

    The problem occurs since "List files from path" requires a folder path ("C:\Users\") and doesn't work if the file name is included ("C:\Users\Test.txt"). It would be logic that "Open folder dialog" which actually let you select a folder, would be compatible with "List files from path" since this needs a folder to work.

    If you compare "List files from path" where you write the path manually like : "C:\Test folder\" and through the "Open folder dialog" where you select the "Test folder" you get the following results.

    Example 1: Uses "Open folder dialog"

    First of all it doesn't actually return the selected folder, but it returns all the files in the folder including those sub folders which have files in it. Comparing that to Example 2, you can see that there is actually a folder in there called "Sub folder 2" which is empty.

    Example 2: Manual written path

    Again it doesn't return the folder name, which is logic, since its manually written. however it does return all the content, except the file d.txt which are in the Sub folder. And which is returned in example 1.

    So putting it all together, its a huge "mess" of incompatible functionality that gives different results depending on how they are used. Which makes it difficult and not very logic to work with, because all things have to be corrected, parsed etc. to make it work.

    That's why it was hard to explain it the first time as a single problem, because it involve a lot of things. Hope it makes a bit more sense now, why there is something wrong with how you as user would expect it to work, compared to how it actually works. Because as it is now its more or less impossible to work with, and requires a lot of workaround to make any use out of it.

    (PS. As I started out saying im not sure if you read closed bug reports, but could you please take a look at this if you normally don't. Whether that would be possible or not: https://www.scirra.com/forum/r200-load-image-from-url-or-nwjs-bug-v2_t128806)

    Attach a Capx


    Description of Capx

    Just open a folder to be used with the ListAt funtionality

    Steps to Reproduce Bug

    Use open folder dialog, ChosenPath and ListAt

    Observed Result

    Open dialog folder is unable to return the path to the folder.

    Expected Result

    Returns every single file and subfolder in the selected folder.

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)
    • Internet Explorer: (YES)

    Operating System and Service Pack

    Windows 7

    Construct 2 Version ID


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can't see anything wrong with your .capx. It would also be less confusing if you produced a minimally simple .capx with no events, not even disabled ones, if they are unrelated to the problem.

    With your example it works correctly no matter if I use:

    List files from "C:\Users\Ashley\Desktop"

    List files from "C:\Users\Ashley\Desktop\"

    List files from NWjs.ChosenPath (after choosing the Desktop folder)

    The last is no surprise, since ChosenPath returns "C:\Users\Ashley\Desktop", and is therefore identical to hard-coding that string. I can't explain why using ChosenPath would produce any different result compared to hard-coding the string it returns. It should in theory be identical, and indeed I have tried it and it is identical.

    At no point can I see anything that looks like your "Example 1" screenshot, which returns a list of files separated by semicolons.

    You should always indicate which version of the software you are using in bug reports, and you haven't included your NW.js version. I'm testing with 0.12.0 and it's working fine. If you're using an older version and that is causing the problem, it won't be fixed, you will just have to update NW.js.

  • Sorry for the messy Capx, I think I changed the one in the link as its from dropbox. So here is a clean one. Only with one issue, so this one focuses on:

    "At no point can I see anything that looks like your "Example 1" screenshot, which returns a list of files separated by semicolons."

    To be sure we are using the same structure for testing, could you make a test structure like so:

    C:\Users\<Name>\Test folder
    C:\Users\<Name>\Test folder\Sub folder 1
    C:\Users\<Name>\Test folder\Sub folder 2
    <No files in this one>
    When I run the program and select "Test folder" I get the following results:
    Regarding the NWjs version:
    I don't know where to find the version number, but I download the one from here: 
    New capx:
  • I made the exact file/folder structure you described, and I still can't reproduce with the latest NW 0.12.0, it correctly lists the results.

    The thread you have linked to is out of date. NW.js versions are now distributed from here: https://www.scirra.com/nwjs

  • Ok I was using the alpha 1 version 0.12.0 from that link, was the only want I could find. So updated to the 0.12.0 non alpha and that solved it. It now list them as it should. Most excellent...thanks a bunch

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