UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
system.h File Reference

System specific stuff. More...

#include "../shared/cxx.h"
#include "../common/list.h"
#include <stdio.h>

Go to the source code of this file.

Functions

void Sys_Init (void)
 
void Sys_NormPath (char *path)
 Normalize path (remove all \ ) More...
 
void Sys_Sleep (int milliseconds)
 Calls the win32 sleep function. More...
 
const char * Sys_GetCurrentUser (void)
 Get current user. More...
 
int Sys_Setenv (const char *name, const char *value)
 set/unset environment variables (empty value removes it) More...
 
void Sys_InitSignals (void)
 
const char * Sys_SetLocale (const char *localeID)
 
const char * Sys_GetLocale (void)
 
const char * Sys_ConsoleInput (void)
 Handles input for the console window. More...
 
void Sys_ConsoleOutput (const char *string)
 
void Sys_Error (const char *error,...) __attribute__((noreturn
 
void format (__printf__, 1, 2)))
 
void Sys_Quit (void)
 
char * Sys_GetHomeDirectory (void)
 Returns the home environment variable (which hold the path of the user's homedir) More...
 
void Sys_ConsoleShutdown (void)
 Shutdown the console. More...
 
void Sys_ConsoleInit (void)
 Initialize the console input (tty mode if possible) More...
 
void Sys_ShowConsole (bool show)
 
char * Sys_FindFirst (const char *path, unsigned musthave, unsigned canthave)
 Opens the directory and returns the first file that matches our searchrules. More...
 
char * Sys_FindNext (unsigned musthave, unsigned canthave)
 Returns the next file of the already opened directory (Sys_FindFirst) that matches our search mask. More...
 
void Sys_FindClose (void)
 Closes the find handle. More...
 
void Sys_ListFilteredFiles (const char *basedir, const char *subdirs, const char *filter, linkedList_t **list)
 
void Sys_Mkdir (const char *path)
 
void Sys_Mkfifo (const char *ospath, struct qFILE_s *f)
 
char * Sys_Cwd (void)
 Get current working dir. More...
 
void Sys_SetAffinityAndPriority (void)
 
int Sys_Milliseconds (void)
 
void Sys_Backtrace (void)
 On platforms supporting it, print a backtrace. More...
 
void Sys_Breakpoint (void)
 
void Sys_OpenURL (const char *url)
 
FILESys_Fopen (const char *filename, const char *mode)
 
int Sys_Remove (const char *filename)
 
int Sys_Rename (const char *oldname, const char *newname)
 
int Sys_Access (const char *filename, int mode)
 

Detailed Description

System specific stuff.

Definition in file system.h.

Function Documentation

void format ( __printf__  ,
,
 
)
int Sys_Access ( const char *  filename,
int  mode 
)

Definition at line 255 of file unix_files.cpp.

References lengthof, MAX_OSPATH, and Sys_Utf8ToUtf16().

Referenced by FS_FileExists().

void Sys_Backtrace ( void  )

On platforms supporting it, print a backtrace.

Note
For windows this is not handled here - see Sys_BacktraceInit

Definition at line 102 of file android_system.cpp.

References androidDumpBacktrace(), BUILDSTRING, Com_BreakIntoDebugger(), Com_UploadCrashDump(), CPUSTRING, FILE, i, Sys_Fopen(), and UFO_VERSION.

Referenced by Com_Error(), Com_SetValue(), Com_ValueToStr(), and Sys_Error().

void Sys_Breakpoint ( void  )

Definition at line 84 of file unix_shared.cpp.

Referenced by Com_BreakIntoDebugger().

void Sys_ConsoleOutput ( const char *  string)

Definition at line 52 of file android_console.cpp.

References sysConsole_t::hWndOutput, len, MAX_OUTPUT, MAX_PRINTMSG, and sysConsole_t::outLen.

Referenced by Com_vPrintf(), and Sys_Error().

char* Sys_Cwd ( void  )

Get current working dir.

Returns
nullptr if getcwd failed

Definition at line 197 of file unix_files.cpp.

References lengthof, MAX_OSPATH, and Sys_Utf16ToUtf8().

Referenced by FS_GetCwd().

void Sys_Error ( const char *  error,
  ... 
)
void Sys_FindClose ( void  )

Closes the find handle.

Note
Call this before calling a new Sys_FindFirst
See also
Sys_FindNext
Sys_FindFirst

Definition at line 142 of file unix_files.cpp.

References fdir.

Referenced by FS_ListFiles().

char* Sys_FindFirst ( const char *  path,
unsigned  musthave,
unsigned  canthave 
)

Opens the directory and returns the first file that matches our searchrules.

See also
Sys_FindNext
Sys_FindClose

Definition at line 87 of file unix_files.cpp.

References Com_FilePath(), Com_Filter(), Com_sprintf(), CompareAttributes(), fdir, findbase, findpath, findpattern, lengthof, Q_streq, Q_strncpyz(), Sys_Error(), Sys_Utf16ToUtf8(), and Sys_Utf8ToUtf16().

Referenced by FS_ListFiles().

char* Sys_FindNext ( unsigned  musthave,
unsigned  canthave 
)

Returns the next file of the already opened directory (Sys_FindFirst) that matches our search mask.

See also
Sys_FindClose
Sys_FindFirst
static var findpattern
Sys_FindFirst
Sys_FindClose

Definition at line 125 of file unix_files.cpp.

References Com_Filter(), Com_sprintf(), CompareAttributes(), fdir, findbase, findpath, findpattern, Q_streq, and Sys_Utf16ToUtf8().

Referenced by FS_ListFiles().

FILE* Sys_Fopen ( const char *  filename,
const char *  mode 
)
const char* Sys_GetCurrentUser ( void  )

Get current user.

Definition at line 44 of file android_system.cpp.

References lengthof, MAX_VAR, Q_strncpyz(), Sys_Utf16ToUtf8(), and user.

Referenced by CL_InitLocal(), Com_UploadCrashDump(), and WEB_InitStartup().

char* Sys_GetHomeDirectory ( void  )

Returns the home environment variable (which hold the path of the user's homedir)

Returns the home environment variable (which hold the path of the user's homedir)

Note
Forced for Windows Vista
Use the cvar fs_usehomedir if you want to use the homedir for other Windows versions, too

Definition at line 45 of file unix_files.cpp.

References Com_Printf(), Q_strcat(), Sys_Utf16ToUtf8(), and Sys_Utf8ToUtf16().

Referenced by FS_GetHomeDirectory().

const char* Sys_GetLocale ( void  )

Definition at line 156 of file win_shared.cpp.

Referenced by CL_LanguageInit().

void Sys_Init ( void  )
void Sys_InitSignals ( void  )

Definition at line 182 of file unix_shared.cpp.

Referenced by main(), and Qcommon_Init().

void Sys_ListFilteredFiles ( const char *  basedir,
const char *  subdirs,
const char *  filter,
linkedList_t **  list 
)
void Sys_Mkdir ( const char *  path)

Definition at line 208 of file unix_files.cpp.

References Com_Printf(), lengthof, MAX_OSPATH, and Sys_Utf8ToUtf16().

Referenced by FS_CreatePath().

void Sys_Mkfifo ( const char *  ospath,
struct qFILE_s f 
)

Definition at line 217 of file unix_files.cpp.

References Com_Printf(), qFILE_s::f, FILE, FS_RemoveFile(), and Sys_Fopen().

Referenced by FS_CreateOpenPipeFile().

void Sys_NormPath ( char *  path)

Normalize path (remove all \ )

Definition at line 50 of file unix_files.cpp.

Referenced by FS_NormPath().

void Sys_OpenURL ( const char *  url)

Definition at line 196 of file unix_shared.cpp.

References Com_sprintf().

Referenced by CL_OpenURL_f().

void Sys_Quit ( void  )
int Sys_Remove ( const char *  filename)

Definition at line 245 of file unix_files.cpp.

References lengthof, MAX_OSPATH, and Sys_Utf8ToUtf16().

Referenced by CL_HTTP_Cleanup(), FS_RemoveFile(), and FS_WriteFile().

int Sys_Rename ( const char *  oldname,
const char *  newname 
)

Definition at line 250 of file unix_files.cpp.

References lengthof, MAX_OSPATH, and Sys_Utf8ToUtf16().

Referenced by FS_RenameFile().

void Sys_SetAffinityAndPriority ( void  )

Referenced by CL_Frame().

int Sys_Setenv ( const char *  name,
const char *  value 
)

set/unset environment variables (empty value removes it)

Returns
nonzero if succeeds
Note
gettext FAQ recommends using both functions to set environment variable(s), so we do

Definition at line 60 of file unix_shared.cpp.

Referenced by CL_Env_f(), CL_LanguageTest(), Rimp_Init(), and Sys_SetLocale().

const char* Sys_SetLocale ( const char *  localeID)

Definition at line 147 of file win_shared.cpp.

References Sys_Setenv().

Referenced by CL_LanguageTryToSet().

void Sys_Sleep ( int  milliseconds)

Calls the win32 sleep function.

Definition at line 68 of file unix_shared.cpp.

References long().

Referenced by M_MusicStreamCallback(), NET_Wait(), R_RenderFrame(), R_RunThread(), and Sys_Error().