mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 22:40:50 +00:00
Don't use a DOS path for the home directory, but a UTF-8 path.
With this commit YQ2 is able to start and run on ReFS volumes. :) At least as long as neither the binary path, the game data path nor the path to the users home directory contain anything but ASCII characters. Please note: This make break some corner cases with hore directories containting unicode characters. They worked until now by pure luck. A better solution providing full unicode support will be committed in the next few days.
This commit is contained in:
parent
4ca38f92fa
commit
54ab3f75db
1 changed files with 1 additions and 20 deletions
|
@ -473,9 +473,7 @@ Sys_GetHomeDir(void)
|
|||
char *cur;
|
||||
char *old;
|
||||
char profile[MAX_PATH];
|
||||
int len;
|
||||
static char gdir[MAX_OSPATH];
|
||||
WCHAR sprofile[MAX_PATH];
|
||||
WCHAR uprofile[MAX_PATH];
|
||||
|
||||
/* The following lines implement a horrible
|
||||
|
@ -489,24 +487,7 @@ Sys_GetHomeDir(void)
|
|||
/* Get the path to "My Documents" directory */
|
||||
SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, 0, uprofile);
|
||||
|
||||
/* Create a UTF-16 DOS path */
|
||||
len = GetShortPathNameW(uprofile, sprofile, sizeof(sprofile));
|
||||
|
||||
if (len == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Since the DOS path contains no UTF-16 characters, just convert it to ASCII */
|
||||
WideCharToMultiByte(CP_ACP, 0, sprofile, -1, profile, sizeof(profile), NULL, NULL);
|
||||
|
||||
if (len == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check if path is too long */
|
||||
if ((len + strlen(CFGDIR) + 3) >= 256)
|
||||
if (WideCharToMultiByte(CP_UTF8, 0, uprofile, -1, profile, sizeof(profile), NULL, NULL) == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue