Windows user settings files now goes to %USERPROFILE%/.torcs-ng/ (GetLocalDir gives it)

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@553 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 7401b3c30e212a4a37559193514f72d3485771b3
Former-commit-id: 315f0b666a3f2ad596b28c70dcf79cfb007ded57
This commit is contained in:
pouillot 2008-12-23 21:59:08 +00:00
parent e3e41193a5
commit 5a164c9c33
2 changed files with 16 additions and 14 deletions

View file

@ -549,8 +549,8 @@ GfScrReinit(void * /* dummy */)
saveParams();
#ifdef WIN32
snprintf(cmd, CMDSIZE, "%swtorcs.exe", GetLocalDir());
int i;
snprintf(cmd, CMDSIZE, "%swtorcs.exe", GetDataDir());
int i;
for (i = 0; i < CMDSIZE && cmd[i] != NULL; i++) {
if (cmd[i] == '/') {
cmd[i] = '\\';
@ -558,7 +558,8 @@ GfScrReinit(void * /* dummy */)
}
char cmdarg[CMDSIZE];
snprintf(cmdarg, CMDSIZE, "\"%swtorcs.exe\"", GetLocalDir());
strcpy(cmdarg, "wtorcs.exe");
//snprintf(cmdarg, CMDSIZE, "wtorcs.exe", GetDataDir());
for (i = 0; i < CMDSIZE && cmdarg[i] != NULL; i++) {
if (cmdarg[i] == '/') {
cmdarg[i] = '\\';
@ -624,7 +625,7 @@ GfScrReinit(void * /* dummy */)
#endif
if (retcode) {
perror("torcs");
perror("wtorcs.exe");
exit(1);
}
}

View file

@ -37,9 +37,8 @@ init_args(int argc, char **argv)
if ((strncmp(argv[i], "-s", 2) == 0) || (strncmp(argv[i], "/s", 2) == 0)) {
i++;
SetSingleTextureMode ();
} else {
} else
i++; // Ignore bad args
}
}
static const int BUFSIZE = 1024;
@ -54,14 +53,10 @@ init_args(int argc, char **argv)
*(end) = '\0';
// replace '\' with '/'
for (i = 0; i < BUFSIZE && buf[i] != '\0'; i++) {
if (buf[i] == '\\') {
if (buf[i] == '\\')
buf[i] = '/';
}
}
// TODO: Let localdir point to users "home" directory (I think on NT successors this exists,
// perhaps HOMEDRIVE, HOMEPATH).
SetLocalDir(buf);
SetDataDir(buf);
SetLibDir("");
} else {
@ -75,11 +70,9 @@ init_args(int argc, char **argv)
*(end) = '\0';
// replace '\' with '/'
for (i = 0; i < BUFSIZE && buf[i] != '\0'; i++) {
if (buf[i] == '\\') {
if (buf[i] == '\\')
buf[i] = '/';
}
}
SetLocalDir(buf);
SetDataDir(buf);
SetLibDir("");
} else {
@ -87,6 +80,14 @@ init_args(int argc, char **argv)
exit(1);
}
}
// Set LocalDir to the user settings dir for Torcs-NG
snprintf(buf, BUFSIZE, "%s/.torcs-ng/", getenv("USERPROFILE"));
for (i = 0; i < BUFSIZE && buf[i] != '\0'; i++) {
if (buf[i] == '\\')
buf[i] = '/';
}
SetLocalDir(buf);
}
/*