blob: 1c4a149c155394230869c6f64361cb3f072eba67 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include "sys_local.h"
#include "qcommon/cvar.h"
#include "qcommon/q_shared.h"
#include "qcommon/q_platform.h"
#include <windows.h>
#include <lmerr.h>
#include <lmcons.h>
#include <lmwksta.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <direct.h>
#include <io.h>
#include <conio.h>
#include <wincrypt.h>
#include <shlobj.h>
#include <psapi.h>
#include <float.h>
// Used to determine where to store user-specific files
static char homePath[ MAX_OSPATH ] = { 0 };
/*
================
Sys_DefaultHomePath
================
*/
char *Sys_DefaultHomePath( void )
{
TCHAR szPath[MAX_PATH];
if(!*homePath && com_homepath)
{
if( !SUCCEEDED( SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, szPath ) ) )
{
Com_Printf("Unable to detect CSIDL_APPDATA\n");
return NULL;
}
Com_sprintf(homePath, sizeof(homePath), "%s%c", szPath, PATH_SEP);
if(com_homepath->string[0])
Q_strcat(homePath, sizeof(homePath), com_homepath->string);
else
Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_WIN);
}
return homePath;
}
|