System

Interactions with the operating system.

string? get_env(string) Get some environment variable if exists void put_env(var : string, val : string) Set some environment variable value void sys_sleep(number) Sleep a given number of seconds bool set_time_locale(string) Set the locale for LC_TIME, returns true on success string get_cwd() Return current working directory void set_cwd(string) Set current working directory string sys_string() Return the local system string. The current value are possible :
  • Windows
  • Linux
  • BSD
  • Mac
bool sys_is64() Returns true if we are on a 64-bit system int sys_command(string) Run the shell command and return exit code void sys_exit(int) Exit with the given errorcode. Never returns. bool sys_exists(string) Returns true if the file or directory exists. bool file_exists(string) Deprecated : use sys_exists instead. void file_delete(string) Delete the file. Exception on error. void sys_rename(from : string, to : string) Rename the file or directory. Exception on error. { gid => int, uid => int, atime => 'int32, mtime => 'int32, ctime => 'int32, dev => int, ino => int, nlink => int, rdev => int, size => int, mode => int } sys_stat(string) Run the stat command on the given file or directory. string sys_file_type(string) Return the type of the file. The current values are possible :
  • file
  • dir
  • symlink
  • sock
  • char
  • block
  • fifo
void sys_create_dir(string, mode : int) Create a directory with the specified rights void sys_remove_dir(string) Remove a directory. Exception on error float sys_time() Return an accurate local time stamp in seconds since Jan 1 1970 float sys_cpu_time() Return the most accurate CPU time spent since the process started (in seconds) string list sys_read_dir(string) Return the content of a directory string file_full_path(string) Return an absolute path from a relative one. The file or directory must exists string sys_exe_path() Return the path of the executable #list sys_env() Return all the (key,value) pairs in the environment as a chained list int sys_getch(bool) Read a character from stdin with or without echo int sys_get_pid() Returns the current process identifier
Report an issue | Contribute to this page

©2017 Haxe Foundation