win_shared.c File Reference

Windows shared functions. More...

#include "../../common/common.h"
#include "win_local.h"
#include <fcntl.h>
#include <direct.h>
#include <io.h>
#include <conio.h>
Include dependency graph for win_shared.c:

Go to the source code of this file.

Defines

#define MAX_FOUND_FILES   0x1000

Functions

int Sys_Milliseconds (void)
void Sys_Mkdir (const char *path)
static qboolean CompareAttributes (unsigned found, unsigned musthave, unsigned canthave)
char * Sys_FindFirst (const char *path, unsigned musthave, unsigned canthave)
 Opens the directory and returns the first file that matches our searchrules.
char * Sys_FindNext (unsigned musthave, unsigned canthave)
 Returns the next file of the already opened directory (Sys_FindFirst) that matches our search mask.
void Sys_FindClose (void)
 Closes the find handle.
void Sys_ListFilteredFiles (const char *basedir, const char *subdirs, const char *filter, linkedList_t **list)
void Sys_Quit (void)
const char * Sys_GetCurrentUser (void)
 Get current user.
char * Sys_Cwd (void)
 Get current working dir.
void Sys_NormPath (char *path)
 Normalize path (remove all \ ).
char * Sys_GetHomeDirectory (void)
 Get the home directory in Application Data.
void Sys_Sleep (int milliseconds)
 Calls the win32 sleep function.
int Sys_Setenv (const char *name, const char *value)
 set/unset environment variables (empty value removes it)
void Sys_InitSignals (void)

Variables

HINSTANCE global_hInstance
static char findbase [MAX_OSPATH]
static char findpath [MAX_OSPATH]
static int findhandle

Detailed Description

Windows shared functions.

Definition in file win_shared.c.


Define Documentation

#define MAX_FOUND_FILES   0x1000

Definition at line 151 of file win_shared.c.


Function Documentation

static qboolean CompareAttributes ( unsigned  found,
unsigned  musthave,
unsigned  canthave 
) [static]

Definition at line 55 of file win_shared.c.

References qfalse, qtrue, SFF_ARCH, SFF_HIDDEN, SFF_RDONLY, SFF_SUBDIR, and SFF_SYSTEM.

Referenced by Sys_FindFirst(), and Sys_FindNext().

char* Sys_Cwd ( void   ) 

Get current working dir.

Returns:
NULL if getcwd failed

Definition at line 238 of file win_shared.c.

References MAX_OSPATH.

Referenced by FS_GetCwd().

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 144 of file win_shared.c.

References findhandle.

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 86 of file win_shared.c.

References Com_FilePath(), Com_sprintf(), CompareAttributes(), findbase, findhandle, findpath, and Sys_Error().

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_FindFirst
Sys_FindClose

Definition at line 118 of file win_shared.c.

References Com_sprintf(), CompareAttributes(), findbase, findhandle, and findpath.

Referenced by FS_ListFiles().

const char* Sys_GetCurrentUser ( void   ) 

Get current user.

Definition at line 224 of file win_shared.c.

References Q_strncpyz().

Referenced by CL_InitLocal().

char* Sys_GetHomeDirectory ( void   ) 

Get the home directory in Application Data.

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 271 of file win_shared.c.

References Com_Printf(), MAX_OSPATH, Q_strcat(), and Q_strncpyz().

Referenced by FS_AddHomeAsGameDirectory().

void Sys_InitSignals ( void   ) 

Definition at line 333 of file win_shared.c.

Referenced by Qcommon_Init().

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

Definition at line 46 of file win_shared.c.

Referenced by FS_CreatePath().

void Sys_NormPath ( char *  path  ) 

Normalize path (remove all \ ).

Definition at line 252 of file win_shared.c.

Referenced by FS_NormPath().

void Sys_Quit ( void   ) 
See also:
Qcommon_Shutdown

Definition at line 190 of file win_shared.c.

References CL_Shutdown(), Mem_Shutdown(), and Qcommon_Shutdown().

Referenced by Com_Quit(), Sys_ConsoleLoop(), and Sys_ConsoleProc().

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

set/unset environment variables (empty value removes it)

Definition at line 324 of file win_shared.c.

References Com_sprintf().

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

void Sys_Sleep ( int  milliseconds  ) 

Calls the win32 sleep function.

Definition at line 314 of file win_shared.c.

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


Variable Documentation

char findbase[MAX_OSPATH] [static]

Definition at line 51 of file win_shared.c.

Referenced by Sys_FindFirst(), and Sys_FindNext().

int findhandle [static]

Definition at line 53 of file win_shared.c.

Referenced by Sys_FindClose(), Sys_FindFirst(), Sys_FindNext(), and Sys_ListFilteredFiles().

char findpath[MAX_OSPATH] [static]

Definition at line 52 of file win_shared.c.

Referenced by Sys_FindFirst(), and Sys_FindNext().

HINSTANCE global_hInstance

Definition at line 33 of file win_shared.c.

Referenced by Sys_ConsoleInit(), Sys_ConsoleShutdown(), and WinMain().


Generated by  doxygen 1.6.2