From f6115375ab01f5b0081182f016e8a59208aee383 Mon Sep 17 00:00:00 2001 From: Casey Langen Date: Thu, 23 Jun 2016 01:16:58 -0700 Subject: [PATCH] Forgot to save a file. Oops. --- src/core/support/Common.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/support/Common.cpp b/src/core/support/Common.cpp index 43a30db6b..476c27884 100644 --- a/src/core/support/Common.cpp +++ b/src/core/support/Common.cpp @@ -92,9 +92,9 @@ std::string musik::core::GetHomeDirectory() { std::string directory; #ifdef WIN32 - DWORD bufferSize = GetEnvironmentVariable(_T("APPDATA"), 0, 0); + DWORD bufferSize = GetEnvironmentVariable(_T("HOMEPATH"), 0, 0); wchar_t *buffer = new wchar_t[bufferSize + 2]; - GetEnvironmentVariable(_T("APPDATA"), buffer, bufferSize); + GetEnvironmentVariable(_T("HOMEPATH"), buffer, bufferSize); directory.assign(u16to8(buffer)); delete[] buffer; #else @@ -105,11 +105,17 @@ std::string musik::core::GetHomeDirectory() { } std::string musik::core::GetDataDirectory() { - std::string directory = GetHomeDirectory(); + std::string directory; #ifdef WIN32 + DWORD bufferSize = GetEnvironmentVariable(_T("APPDATA"), 0, 0); + wchar_t *buffer = new wchar_t[bufferSize + 2]; + GetEnvironmentVariable(_T("APPDATA"), buffer, bufferSize); + directory.assign(u16to8(buffer)); directory.append("/mC2/"); + delete[] buffer; #else + directory = std::string(std::getenv("HOME")); directory.append("/.mC2/"); #endif