-
Notifications
You must be signed in to change notification settings - Fork 0
/
use_xdg_config_home.patch
52 lines (50 loc) · 1.49 KB
/
use_xdg_config_home.patch
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
diff --git a/src/paths.c b/src/paths.c
index 53aece07..69207171 100644
--- a/src/paths.c
+++ b/src/paths.c
@@ -240,44 +240,9 @@ static void Paths_InitHomeDirs(void)
{
/* $HOME not set, so let's use current working dir as home */
sUserHomeDir = Str_Dup(sWorkingDir);
- sHatariHomeDir = Str_Dup(sWorkingDir);
- return;
- }
-
- sHatariHomeDir = Str_Alloc(strlen(sUserHomeDir) + 1 + strlen(HATARI_HOME_DIR));
-
- /* Try to use a private hatari directory in the users home directory */
- sprintf(sHatariHomeDir, "%s%c%s", sUserHomeDir, PATHSEP, HATARI_HOME_DIR);
- if (File_DirExists(sHatariHomeDir))
- {
- return;
- }
- /* Try legacy location ~/.hatari */
- sprintf(sHatariHomeDir, "%s%c.hatari", sUserHomeDir, PATHSEP);
- if (File_DirExists(sHatariHomeDir))
- {
- return;
- }
-
- /* Hatari home directory does not exists yet...
- * ... so let's try to create it: */
-#if !defined(__APPLE__) && !defined(WIN32)
- sprintf(sHatariHomeDir, "%s%c.config", sUserHomeDir, PATHSEP);
- if (!File_DirExists(sHatariHomeDir))
- {
- /* ~/.config does not exist yet, create it first */
- if (mkdir(sHatariHomeDir, 0700) != 0)
- {
- perror("Failed to create ~/.config directory");
- }
- }
-#endif
- sprintf(sHatariHomeDir, "%s%c%s", sUserHomeDir, PATHSEP, HATARI_HOME_DIR);
- if (mkdir(sHatariHomeDir, 0750) != 0)
- {
- /* Failed to create, so use user's home dir instead */
- strcpy(sHatariHomeDir, sUserHomeDir);
- }
+ }
+ sHatariHomeDir = Str_Alloc(4096);
+ strcpy(sHatariHomeDir, getenv("XDG_CONFIG_HOME"));
}