Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Griver03 on April 10, 2012, 06:37:58 pm

Title: [XP] Environment Path
Post by: Griver03 on April 10, 2012, 06:37:58 pm
hi there again, i want to save my savvegames in the My Games folder like real games do that.
i tryed %PATH% and [PATH] allready but it doesnt work...
how can i use an environment path in rmxp ? (some games can that)
and if it works how can i check if the folder exists and if it not exists make rmxp to create it ?
because it crashes when a folder not exists...

thx alot in advance
Title: Re: [XP] Environment Path
Post by: ForeverZer0 on April 10, 2012, 10:36:15 pm
There is a constant called "ENV" in Ruby, which has the environment variables in it. It is a hash, with the names of the variables as the keys. You can see all the keys by using this in Ruby:

p ENV.keys.sort


You can check if a file exists by using:

File.exist?('FILENAME')
Title: Re: [XP] Environment Path
Post by: Griver03 on April 11, 2012, 03:16:30 am
thx dude :)