SA-MP Forums Archive
C# WinDir - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: C# WinDir (/showthread.php?tid=398093)



C# WinDir - s3rious - 08.12.2012

Hi guys. I want to ask you

How can I change this
pawn Код:
private string GetSysFilePath()
        {
            string filepath = (@"C:\text.txt");
   
            return filepath;
        }
String "C:\text.txt" must be indenpence of each type of PC. Example windows could be installed on D: drive.
Exist some function like - "%systemroot%" or something like that. ? thanks


Re: C# WinDir - TheDeadlyDutchi - 08.12.2012

You can use Environment.GetEnvironmentVariable for this.
Код:
Environment.GetEnvironmentVariable("SystemRoot")



Re: C# WinDir - s3rious - 08.12.2012

and what it is returning?


Re: C# WinDir - playbox12 - 08.12.2012

Probably the system drive letter (C, D) etc. Why don't you look it up in the documentation?


Re: C# WinDir - Makaveli93 - 08.12.2012

http://stackoverflow.com/questions/5...uch-as-c-drive
http://stackoverflow.com/questions/7...e-of-the-drive

https://www.******.hr/search?q=c+sha...hrome&ie=UTF-8

It's easy to search...