Windows All Folder Files Listing

Discussion in 'Programming' started by LMAX, Jan 10, 2019.

  1. LMAX

    LMAX Member

    Joined:
    Jan 9, 2019
    Posts:
    9
    Hello !

    Please tell me how can I create a list with all files from a specified path and folder (E:\TEST\*.*)

    Thank You !
     
  2. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    1,929
    As that location would be outside of the sandboxed file system that GMS 1 and 2 uses, you would have to use an extension. There are some available on the marketplace.

    If you have an older version of Game maker, I think they can do it without an extension.
     
  3. LMAX

    LMAX Member

    Joined:
    Jan 9, 2019
    Posts:
    9
    I don't need an extension...
    I need my own code to do that...
     
  4. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    3,681
    Then I suggest you put some effort in and take a look at the manual, then ask any questions you might have once you have at least tried to do it yourself. Both of your threads are begging people to do it for you, that's now how the forum works and not how you learn anything yourself.

    Start here:
    File System Functions
    Sandboxing
     
    Death likes this.
  5. LMAX

    LMAX Member

    Joined:
    Jan 9, 2019
    Posts:
    9
    please tell me why this code is not working :
    findfile=file_find_first("E:\TEST_FOLDER\*.*", fa_directory);
    while (findfile!="")
    {
    show_message(findfile);
    findfile=file_find_next();

    }
    file_find_close();
     
    Last edited: Jan 11, 2019
  6. Zep--

    Zep-- Member

    Joined:
    Jan 1, 2019
    Posts:
    25
    Maybe that dir is not in the "sandbox" and/or needs explicit permission as the documentation states.
     
  7. LMAX

    LMAX Member

    Joined:
    Jan 9, 2019
    Posts:
    9
    Can somebody be more specific?
    TEST_FOLDER is an ordinary folder on my Windows "E" drive.
    Please just tell me how can I read all the files names from that folder through code or how to set working directory to that folder.
    I need to create a list with the files to use it in my game.
    Thank You !
     
  8. Zep--

    Zep-- Member

    Joined:
    Jan 1, 2019
    Posts:
    25
    You need to try your code to use the same folder as where the executable is located (ie: the sandbox). if it works there, you have your answer.
     
  9. Catan

    Catan Member

    Joined:
    Jun 20, 2016
    Posts:
    484
    Please read what the others are saying, the keyword here is "sandbox". In short: you can not read files or folders on your hard drive other than the game folder game maker creates for you. That's your sandbox. So no, you can't read the files from "E:\TEST_FOLDER\" natively in game maker.

    You may be able to do that with an extension from the marketplace.
     
  10. RefresherTowel

    RefresherTowel Member

    Joined:
    Jul 13, 2016
    Posts:
    985
    Gee whiz. Your question has been answered and answered and answered. GM runs inside a SANDBOX. What this means is that you do not have access to all the folders on the drive. You ONLY HAVE ACCES TO the %localappdata%\<Game Name> directory. That's it. Ain't no way of getting around it WITHOUT USING AN EXTENSION. Your E:\Test folder is quite obviously not inside the %localappdata%\<Game Name> directory so you DO NOT HAVE ACCESS TO IT. That is, unless you use an extension, which has been mentioned multiple times already. (This is specifically for windows, other platforms will have another specific place in the drive that you have access to, but the exact same scenario applies).
     
    IndianaBones likes this.
  11. LMAX

    LMAX Member

    Joined:
    Jan 9, 2019
    Posts:
    9
    Now I understand this limitation of GM.
    I will try to put my folder where the GM .exe file is located.
    Thank You !
     
  12. LMAX

    LMAX Member

    Joined:
    Jan 9, 2019
    Posts:
    9
    Please tell me where can I find this extension.
    Thank you !
     
  13. Death

    Death Member

    Joined:
    Aug 8, 2018
    Posts:
    79
  14. LMAX

    LMAX Member

    Joined:
    Jan 9, 2019
    Posts:
    9
    Thank You All Very Much !
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice