eina: handle fallback to HOMEDIR/HOMEPATH on WIN32.

This commit is contained in:
Cedric BAIL 2015-05-14 20:14:56 +02:00
parent 756ed9ccba
commit 01e5432657
1 changed files with 11 additions and 0 deletions

View File

@ -40,6 +40,10 @@
* API *
*============================================================================*/
#ifdef _WIN32
static char home_storage[PATH_MAX];
#endif
EAPI const char *
eina_environment_home_get(void)
{
@ -48,6 +52,13 @@ eina_environment_home_get(void)
home = getenv("USERPROFILE");
if (!home) home = getenv("WINDIR");
if (!home &&
(getenv("HOMEDRIVE") && getenv("HOMEPATH")))
{
snprintf(home_storage, sizeof(home_storage), "%s%s",
getenv("HOMEDRIVE"), getenv("HOMEPATH"));
home = home_storage;
}
if (!home) home = "C:\\";
return home;