3709192002-03-20Martin Nilsson #pike __REAL_VERSION__
29a20a2003-04-27Martin Nilsson #pragma strict_types
3709192002-03-20Martin Nilsson 
fd37f52011-04-25Martin Stjernholm // $Id$
29a20a2003-04-27Martin Nilsson // This module is to allow the _system module to be called System.
d8d4a42001-04-29Mirar (Pontus Hagland) 
fc398b2001-05-31Fredrik Hübinette (Hubbe) inherit _system;
832dd62002-02-21Per Hedbor  constant Timer = __builtin.Timer; constant Time = __builtin.Time;
d919812012-07-17Bill Welliver  //! Get the username of the user the process is running as. //! //! @note //! On NT systems, this returns the user the current thread is running as. string get_user() { #if constant(System.GetUserName) return System.GetUserName(); #elseif constant(System.getuid) return getpwuid(System.getuid())[0]; #else return "UNKNOWN"; #endif /* System.GetUserName */ } //! Get the full path for the current user's home directory string get_home() { string home = [string]getenv("HOME"); if(home) return home; #if __NT__ string homedrive = [string]getenv("HOMEDRIVE"); home = [string]getenv("HOMEPATH"); if(homedrive) home = homedrive + (home || "\\"); if(home) return home; #endif return 0; }