少年修仙传客户端基础资源
hch
2024-04-01 d01413b00ef631ac20347716b23818b0b811f65f
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <stdlib.h>
#include <glib.h>
 
#include "Environment-c-api.h"
#include "Locale-c-api.h"
#include "Path-c-api.h"
 
gboolean
g_hasenv(const gchar *variable)
{
    return g_getenv(variable) != NULL;
}
 
gchar *
g_getenv(const gchar *variable)
{
    return UnityPalGetEnvironmentVariable(variable);
}
 
gboolean
g_setenv(const gchar *variable, const gchar *value, gboolean overwrite)
{
    // This method assumes overwrite is always true.
    UnityPalSetEnvironmentVariable(variable, value);
 
    // No code in Mono actually checks the return value.
    return TRUE;
}
 
void
g_unsetenv(const gchar *variable)
{
    UnityPalSetEnvironmentVariable(variable, "");
}
 
static gboolean locale_initialized = FALSE;
 
gchar*
g_win32_getlocale(void)
{
    if (locale_initialized == FALSE)
    {
        UnityPalLocaleInitialize();
        locale_initialized = TRUE;
    }
 
    return UnityPalGetLocale();
}
 
gboolean
g_path_is_absolute(const char *filename)
{
    return UnityPalIsAbsolutePath(filename);
}
 
const gchar *
g_get_home_dir(void)
{
    return UnityPalGetHomeDirectory();
}
 
const char *
g_get_user_name(void)
{
    return UnityPalGetOsUserName();
}
 
static const char *tmp_dir;
 
const gchar *
g_get_tmp_dir(void)
{
    if (tmp_dir == NULL)
        tmp_dir = UnityPalGetTempPath();
 
    return tmp_dir;
}