User Tag List

Results 1 to 6 of 6

Thread: [HELP] File and Directory Creation Issue

  1. #1
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    MYCRAFTisbest's Avatar
    Join Date
    Sep 2015
    Location
    NY
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question [HELP] File and Directory Creation Issue

    Hello there. Recently I've noticed a problem in a game I'm working on called Galactic Space Agency (GSA for short). The problem involves saving. Saves are stored to "Installed Directory"\Saves\Default with the installed directory generally being Program Files (x86)\GalacticSpaceAgency

    After some tests, I've found that the game is failing to create new directories as well as new files. Running the program as administrator allows the files and directories to be created and modified. I could build the program to execute as administrator by default, but I know there are games and programs that can create files within it's installed folder for saves and does not require to be run as an administrator. Alternatively, if there is a way to save files to "My Documents" as that would also be acceptable.

    I do NOT want to save to AppData as I want the files easily accessible to any and all users. I feel it is more inviting like that and is one of the reasons I chose to use Clickteam over a competitor that demands AppData as the install path. AppData will only serve as a last resort.

    I have only tested this on Windows 10, but I will test on Windows XP and 7 later today. I don't remember having problems in the past and I am almost 100% sure that it used to work properly. Maybe there was a recent change or maybe I somehow failed to test saving outside of CF 2.5. Even if the problem is exclusive to Windows 10, I need it to be compatible on all modern Windows installations.

    Here are some screenshots of some of the code that I have for saving the game that may help.

    EasyReadApppath.jpg
    Apppath1.jpg
    Apppath2.jpg

    Thank You!

  2. #2
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    919
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hmm I use appath$ for my game's save files which are located in a separate folder in the same folder as the exe itself. It's easily accessible to anybody who can run the game as it's right next to it It works perfectly on everything I've tested so far. If you don't want people messing around with stuff you could use it in conjunction with the blowfish object to encrypt your saves if you want.

    I have 3 ini files in this folder that are encrypted as such and though I'm sure it's not bulletproof it's not an easy but to crack for most people. Also the game will create the save file at that specific location when none exists (ex. The game was just downloaded and the folder for saves is empty.)

    I think trying to hard code a set path to somebody's My Documents is probably not a good idea but of course you should do what you want to do!

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export Module

    Join Date
    Dec 2013
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I do NOT want to save to AppData as I want the files easily accessible to any and all users. I feel it is more inviting like that and is one of the reasons I chose to use Clickteam over a competitor that demands AppData as the install path. AppData will only serve as a last resort.
    Please use the appdata folder! It is a pain that every developer tries to save to the installed folder! Installed folder usually means that it is stored in the program files folder. These are protected folders, therefor the user needs admin rights, or the application needs admin rights to start!

    THIS also explains your error, as regular apps that are started with user right have NO right to create to modify any files in the games folder.

  4. #4
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    MYCRAFTisbest's Avatar
    Join Date
    Sep 2015
    Location
    NY
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Del_Duio View Post
    Hmm I use appath$ for my game's save files which are located in a separate folder in the same folder as the exe itself. It's easily accessible to anybody who can run the game as it's right next to it It works perfectly on everything I've tested so far. If you don't want people messing around with stuff you could use it in conjunction with the blowfish object to encrypt your saves if you want.

    I have 3 ini files in this folder that are encrypted as such and though I'm sure it's not bulletproof it's not an easy but to crack for most people. Also the game will create the save file at that specific location when none exists (ex. The game was just downloaded and the folder for saves is empty.)

    I think trying to hard code a set path to somebody's My Documents is probably not a good idea but of course you should do what you want to do!

    For some reason it isn't working for me, at least not on Windows 10. It works normally as an administrator or when compiled with Virtualization (although it only creates a few empty directory and blank files in the apppath and the rest is saved somewhere else). If I just run it normally (as an invoker) it can only read files, it can't create them or directories.

    I assume your game is also in Program Files (x86), or is it elsewhere?

    Also I want to clarify, I was asking if there was something like apppath$ that could get the User so that I can save it in the proper My Documents folder.
    I also have no problem with people messing with the files, if anything I'm trying to encourage it and plan to add in mod support through the use of Sub Applications that can mess with global variables.

    Hopefully I can figure out why it isn't giving me permission to create files there.

    Quote Originally Posted by Vaxx View Post
    Please use the appdata folder! It is a pain that every developer tries to save to the installed folder! Installed folder usually means that it is stored in the program files folder. These are protected folders, therefor the user needs admin rights, or the application needs admin rights to start!

    THIS also explains your error, as regular apps that are started with user right have NO right to create to modify any files in the games folder.
    I am aware it is a protected folder, but I am confused as to why other games are able to save there fine without prompting for administrator rights. The game that inspired my own, Kerbal Space Program, is a Unity game that creates new directories and files inside the program files perfectly fine. Why is that game, as well as others, exempt from this?

    Also I don't like AppData because it is a hidden folder. I want files to be easily accessed.

  5. #5
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    MYCRAFTisbest's Avatar
    Join Date
    Sep 2015
    Location
    NY
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can imagine that it is probably not possible to change files in the program folder without administrator access, at least in clickteam.

    Can someone tell me the AppPath$ equivalent for finding the active windows user? I can do $AppDrive to figure out what drive the user is in, but I don't know how to find up to Drive:\Users\"Name Of User"\My Documents

    Otherwise, I might just put it on the root of the drive at C:\GalacticSpaceAgency

    EDIT: I went ahead and checked and the contents of the Steam folder seem to negate the need for permission to create and modify files and directories. That's weird, I guess the subfolder has different permissions, which is how some games can get away with writing to their own folder. I think I'd rather save to My Documents than figure out how to make an installer set the permissions correctly.

  6. #6
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    MYCRAFTisbest's Avatar
    Join Date
    Sep 2015
    Location
    NY
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have found a solution my problem.

    It was much easier to find an install package creator that had the option to change permissions to folders during the installation process. From now on, the GalacticSpaceAgency folder will be granted Write permissions to all users on installation.

    Thank you all for the help.

Similar Threads

  1. Multi Creation Issue
    By Exavi in forum Lacewing
    Replies: 2
    Last Post: 3rd March 2009, 09:56 PM
  2. Getting a file's directory
    By YAS in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 22nd October 2006, 08:47 AM
  3. Getting a file's directory
    By YAS in forum Extension Development
    Replies: 0
    Last Post: 21st October 2006, 09:12 PM
  4. Suppressing "Directory Creation" message
    By Kevin in forum Install Creator and Patch Maker
    Replies: 2
    Last Post: 25th August 2006, 04:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •