|
2 | 2 | #define MAX(a,b) ((a)>(b)?(a):(b)) |
3 | 3 | #endif |
4 | 4 |
|
| 5 | +#undef DIRSEPARATOR |
| 6 | +#ifdef _WIN32 |
| 7 | +# define DIRSEPARATOR "\\" |
| 8 | +#else |
| 9 | +# define DIRSEPARATOR "/" |
| 10 | +#endif |
| 11 | + |
| 12 | + |
5 | 13 | static void modland_com_cachedir_Draw ( |
6 | 14 | struct console_t *console, |
7 | 15 | const int origselected, |
@@ -59,31 +67,31 @@ static void modland_com_cachedir_Draw ( |
59 | 67 |
|
60 | 68 | mlTop++; |
61 | 69 |
|
62 | | - console->DisplayPrintf (mlTop++, mlLeft, 0x09, mlWidth, " (%.2o%c%.9o) " "%*.*o" "$OCPDATAHOME/modland.com" "%0.7o (default)", |
| 70 | + console->DisplayPrintf (mlTop++, mlLeft, 0x09, mlWidth, " (%.2o%c%.9o) " "%*.*o" "$OCPDATAHOME" DIRSEPARATOR "modland.com" "%0.7o (default)", |
63 | 71 | (0==origselected) ? '*' : ' ', |
64 | 72 | (0==selected) ? 7 : 0, |
65 | 73 | (0==selected) ? 1 : 3); |
66 | 74 | console->DisplayPrintf (mlTop++, mlLeft, 0x07, mlWidth, " => %*S", mlWidth - 8, ocpdatahome_modland_com); |
67 | 75 |
|
68 | 76 | mlTop++; |
69 | 77 |
|
70 | | - console->DisplayPrintf (mlTop++, mlLeft, 0x09, mlWidth, " (%.2o%c%.9o) " "%*.*o" "$HOME/modland.com%0.7o", |
| 78 | + console->DisplayPrintf (mlTop++, mlLeft, 0x09, mlWidth, " (%.2o%c%.9o) " "%*.*o" "$HOME" DIRSEPARATOR "modland.com%0.7o", |
71 | 79 | (1==origselected) ? '*' : ' ', |
72 | 80 | (1==selected) ? 7 : 0, |
73 | 81 | (1==selected) ? 1 : 3); |
74 | 82 | console->DisplayPrintf (mlTop++, mlLeft, 0x07, mlWidth, " => %*S", mlWidth - 8, home_modland_com); |
75 | 83 |
|
76 | 84 | mlTop++; |
77 | 85 |
|
78 | | - console->DisplayPrintf (mlTop++, mlLeft, 0x09, mlWidth, " (%.2o%c%.9o) " "%*.*o" "$OCPDATA/modland.com" "%0.7o (might not be writable)", |
| 86 | + console->DisplayPrintf (mlTop++, mlLeft, 0x09, mlWidth, " (%.2o%c%.9o) " "%*.*o" "$OCPDATA" DIRSEPARATOR "modland.com" "%0.7o (might not be writable)", |
79 | 87 | (2==origselected) ? '*' : ' ', |
80 | 88 | (2==selected) ? 7 : 0, |
81 | 89 | (2==selected) ? 1 : 3); |
82 | 90 | console->DisplayPrintf (mlTop++, mlLeft, 0x07, mlWidth, " => %*S", mlWidth - 8, ocpdata_modland_com); |
83 | 91 |
|
84 | 92 | mlTop++; |
85 | 93 |
|
86 | | - console->DisplayPrintf (mlTop++, mlLeft, 0x09, mlWidth, " (%.2o%c%.9o) " "%*.*o" "$TEMP/modland.com" "%0.7o (might not be system uniqe and writable)", |
| 94 | + console->DisplayPrintf (mlTop++, mlLeft, 0x09, mlWidth, " (%.2o%c%.9o) " "%*.*o" "TEMP" DIRSEPARATOR "modland.com" "%0.7o (might not be system uniqe and writable)", |
87 | 95 | (3==origselected) ? '*' : ' ', |
88 | 96 | (3==selected) ? 7 : 0, |
89 | 97 | (3==selected) ? 1 : 3); |
@@ -204,10 +212,10 @@ static void modland_com_cachedir_Save (const struct DevInterfaceAPI_t *API, int |
204 | 212 | free (modland_com.cacheconfig); |
205 | 213 | switch (selected) |
206 | 214 | { |
207 | | - case 0: modland_com.cacheconfig = modland_com_strdup_slash_filesystem ("$OCPDATAHOME/modland.com/"); break; |
208 | | - case 1: modland_com.cacheconfig = modland_com_strdup_slash_filesystem ("$HOME/modland.com/"); break; |
209 | | - case 2: modland_com.cacheconfig = modland_com_strdup_slash_filesystem ("$OCPDATA/modland.com/"); break; |
210 | | - case 3: modland_com.cacheconfig = modland_com_strdup_slash_filesystem ("$TEMP/modland.com/"); break; |
| 215 | + case 0: modland_com.cacheconfig = modland_com_strdup_slash_filesystem ("$OCPDATAHOME" DIRSEPARATOR "modland.com"); break; |
| 216 | + case 1: modland_com.cacheconfig = modland_com_strdup_slash_filesystem ("$HOME" DIRSEPARATOR "modland.com"); break; |
| 217 | + case 2: modland_com.cacheconfig = modland_com_strdup_slash_filesystem ("$OCPDATA" DIRSEPARATOR "modland.com/"); break; |
| 218 | + case 3: modland_com.cacheconfig = modland_com_strdup_slash_filesystem ("$TEMP" DIRSEPARATOR "modland.com/"); break; |
211 | 219 |
|
212 | 220 | default: |
213 | 221 | case 4: |
@@ -250,28 +258,28 @@ static void modland_com_cachedir_Run (const struct DevInterfaceAPI_t *API) |
250 | 258 |
|
251 | 259 | if (((!strncmp (modland_com.cacheconfig, "~\\", 2)) || |
252 | 260 | (!strncmp (modland_com.cacheconfig, "~/" , 2))) && |
253 | | - (!strcmp (modland_com.cacheconfig + 2, "modland.com"))) |
| 261 | + (!strcmp (modland_com.cacheconfig + 2, "modland.com" DIRSEPARATOR))) |
254 | 262 | { |
255 | 263 | selected = 1; |
256 | 264 | } else if (((!strncmp (modland_com.cacheconfig, "$HOME\\", 6)) || |
257 | 265 | (!strncmp (modland_com.cacheconfig, "$HOME/" , 6))) && |
258 | | - (!strcmp (modland_com.cacheconfig + 6, "modland.com/"))) |
| 266 | + (!strcmp (modland_com.cacheconfig + 6, "modland.com" DIRSEPARATOR))) |
259 | 267 | { |
260 | 268 | selected = 1; |
261 | 269 |
|
262 | 270 | } else if (((!strncmp (modland_com.cacheconfig, "$OCPDATAHOME\\", 13)) || |
263 | 271 | (!strncmp (modland_com.cacheconfig, "$OCPDATAHOME/", 13))) && |
264 | | - (!strcmp (modland_com.cacheconfig + 13, "modland.com/"))) |
| 272 | + (!strcmp (modland_com.cacheconfig + 13, "modland.com" DIRSEPARATOR))) |
265 | 273 | { |
266 | 274 | selected = 0; |
267 | 275 | } else if (((!strncmp (modland_com.cacheconfig, "$OCPDATA\\", 9)) || |
268 | 276 | (!strncmp (modland_com.cacheconfig, "$OCPDATA/", 9))) && |
269 | | - (!strcmp (modland_com.cacheconfig + 9, "modland.com/"))) |
| 277 | + (!strcmp (modland_com.cacheconfig + 9, "modland.com" DIRSEPARATOR))) |
270 | 278 | { |
271 | 279 | selected = 2; |
272 | 280 | } else if (((!strncmp (modland_com.cacheconfig, "$TEMP\\", 6)) || |
273 | 281 | (!strncmp (modland_com.cacheconfig, "$TEMP/", 6))) && |
274 | | - (!strcmp (modland_com.cacheconfig + 9, "modland.com/"))) |
| 282 | + (!strcmp (modland_com.cacheconfig + 6, "modland.com" DIRSEPARATOR))) |
275 | 283 | { |
276 | 284 | selected = 3; |
277 | 285 | } else { |
|
0 commit comments