summaryrefslogtreecommitdiffstats
path: root/MultiMC.cpp
diff options
context:
space:
mode:
authorrobotbrain <robotbrainify@gmail.com>2014-03-05 16:20:45 -0500
committerrobotbrain <robotbrainify@gmail.com>2014-03-05 16:20:45 -0500
commit97ad7d287c8d99aae6e5f030e1d5669b36ee254b (patch)
treec4baa6117611e79c60dc99cbc05f9bb0de062547 /MultiMC.cpp
parenta4779d32b60c0e324f719bd25c76a94c0384ac2e (diff)
downloadMultiMC-97ad7d287c8d99aae6e5f030e1d5669b36ee254b.tar
MultiMC-97ad7d287c8d99aae6e5f030e1d5669b36ee254b.tar.gz
MultiMC-97ad7d287c8d99aae6e5f030e1d5669b36ee254b.tar.lz
MultiMC-97ad7d287c8d99aae6e5f030e1d5669b36ee254b.tar.xz
MultiMC-97ad7d287c8d99aae6e5f030e1d5669b36ee254b.zip
Use windows api to prevent encoding problems.
Diffstat (limited to 'MultiMC.cpp')
-rw-r--r--MultiMC.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/MultiMC.cpp b/MultiMC.cpp
index 595643f8..51fd84ac 100644
--- a/MultiMC.cpp
+++ b/MultiMC.cpp
@@ -38,6 +38,10 @@
#include "logger/QsLog.h"
#include <logger/QsLogDest.h>
+#ifdef Q_OS_WIN32
+#include "windows.h"
+#endif
+
using namespace Util::Commandline;
MultiMC::MultiMC(int &argc, char **argv, bool root_override)
@@ -319,7 +323,12 @@ void MultiMC::initGlobalSettings()
#ifdef Q_OS_LINUX
QString ftbDefault = QDir::home().absoluteFilePath(".ftblauncher");
#elif defined(Q_OS_WIN32)
- QString ftbDefault = PathCombine(qgetenv("APPDATA"), "ftblauncher");
+ wchar_t buf[1000];
+ if(!GetEnvironmentVariableW(L"APPDATA", buf, 1000))
+ {
+ QLOG_FATAL() << "Your APPDATA folder is missing! If you are on windows, this means your system is corrupt. If you aren't on windows, you have a problem.";
+ }
+ QString ftbDefault = PathCombine(QString::fromWCharArray(buf), "ftblauncher");
#elif defined(Q_OS_MAC)
QString ftbDefault =
PathCombine(QDir::homePath(), "Library/Application Support/ftblauncher");