aboutsummaryrefslogtreecommitdiffstats
path: root/erts/etc
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2017-10-18 10:22:07 +0200
committerLukas Larsson <[email protected]>2017-10-18 10:22:07 +0200
commit28cb07aa4b0c91b444ce723ac968987c3a008008 (patch)
tree802b3443837d033e38c2f81a0b4d4cd7f54888a4 /erts/etc
parent6fc556a83e50de658291ad730b67c23041a6119f (diff)
parent9afdaa2a401a0dbe5820df48212d33ec2cdb6144 (diff)
downloadotp-28cb07aa4b0c91b444ce723ac968987c3a008008.tar.gz
otp-28cb07aa4b0c91b444ce723ac968987c3a008008.tar.bz2
otp-28cb07aa4b0c91b444ce723ac968987c3a008008.zip
Merge branch 'maint'
Diffstat (limited to 'erts/etc')
-rw-r--r--erts/etc/common/erlexec.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/erts/etc/common/erlexec.c b/erts/etc/common/erlexec.c
index d61a3cbf95..08e326b33b 100644
--- a/erts/etc/common/erlexec.c
+++ b/erts/etc/common/erlexec.c
@@ -31,6 +31,7 @@
#ifdef __WIN32__
# include "erl_version.h"
# include "init_file.h"
+# include <Shlobj.h>
#endif
#define NO 0
@@ -1531,17 +1532,16 @@ static void get_parameters(int argc, char** argv)
static void
get_home(void)
{
- int len;
- char tmpstr[MAX_PATH+1];
+ wchar_t *profile;
char* homedrive;
char* homepath;
homedrive = get_env("HOMEDRIVE");
homepath = get_env("HOMEPATH");
if (!homedrive || !homepath) {
- if (len = GetWindowsDirectory(tmpstr,MAX_PATH)) {
- home = emalloc(len+1);
- strcpy(home,tmpstr);
+ if (SHGetKnownFolderPath(&FOLDERID_Profile, 0, NULL, &profile) == S_OK) {
+ home = utf16_to_utf8(profile);
+ /* CoTaskMemFree(profile); */
} else
error("HOMEDRIVE or HOMEPATH is not set and GetWindowsDir failed");
} else {