+ 1
Is this even possible?
Trying to currently make a program in C# which will grab all config files from a steam folder however there is no exact path to the directory as everyone who uses the program could have it: C: or D: etc. the only common thing is /steamapps/common/. Is there any way to do that without prompting the user to choose file location?
5 Respostas
+ 3
You would use the Exists() method for File or Directory. e.g if (File.Exists("c:\Steam\steamapps\common\Rusts\cfg\config.cfg")) { // code for true }
+ 3
It is possible if you want to read from the registery, steam app configuration files, etc. Your simplest option would likely be to check if standard locations exist and prompt the user for a location if not found.
There are examples of the harder way on Stack Exchange.
+ 2
You could skip the else clause entirely actually.
cfgfilepath = "\default\path\to\file.cfg"
if (File.Exists(cfgfilepath) == null) {
// Prompt user for file path.
}
0
Brandon How would i check if the standard location exist for example /Steam/steamapps/common/Rusts/cfg/config.cfg.
Obviously using an if else statement there but what would be the code to check to see if it exists?
0
And then for the else just use a standard choose location window? :) also that is very helpful thank you!