Renaming folders/directories in GMS

This might be a scumbag move and I apologize if it is.
I already posted this question in the game maker studio forums, however, I'm not sure how long that is going to take and I know there are a few game maker studio users here.

Is it possible to rename an existing folder/directory?
I was hoping file_rename("filename", "newfilename"); would work but alas, it doesn't.

Thanks in advance. :)

Comments

  • I think you might need to create a new directory with the name you want it to have, copy everything in the old directory there, delete the old directory content, then delete the old directory. That might get tedious if the GM file commands don't do deep copies :(
  • edited
    Thanks, hopefully someone on the yoyo forums know an extension that can do this.
    Also, I don't believe deleting of directories are possible either... lol.
    In retrospect its not THAT big of a train smash the alternative (that doesn't involve moving directories at all) is just bit tedious to code.
    I just cant understand how creating paths are possible but not editing them...
  • Paging @Karuji... He has tons of GMS experience, should be the best person to ask. Good luck!
  • Perhaps it might be a good idea to explain why you're looking to do this? There might well be easier/better ways to achieve the same thing...
  • I'll second dis in asking what you are trying to do with this. In general GM:S isn't too great at file stuff (and it's limited to working with only stuff in your AppDirs)

    In general GM only uses files for saving progress and configs for the game, beyond that it's not really designed to work and it will be a bit of a pain in the arse.

    But if you tell us what you are trying to do we should be able to help or at least point you in the right direction.
  • Wow, did not expect this response. Sorry for the delay. Yoyogames forums gave me the reply of using a batch file, which I can look into with connection to possible cross platform extensions.

    This is incredibly difficult to explain over the web, however I did find a nice alternative solution.
    Even though I cant delete a directory, dislekcia gave me the idea of writing everything in a permanent "temporary" directory then once the file name has been decided everything is copied over to the new directory, eliminating the need for renaming. This solution allows me to keep my favorable file setup without using the far more tedious approach I referred to in my previous post.

    However, I will definitely explain at the meetup on the 25th of February if anyone still want to know what the problem was and even discuss it further, it will just be so much simpler in person.
    Once again, thanks for all the support! :)
  • Glad you have it working :)

    Just out of curiosity: are you doing something like creating a bunch of default settings for the player, and then creating a derivative of that for their customized settings?
  • edited
    No. But I have a settings.ini that is filled with default settings if the file does not yet exist or if an ini entry is removed it will re-add the entry with a default setting. Default settings being hard coded.
Sign In or Register to comment.