git repos / PlatformFolders

commit fff3cc86

sum01 · 2018-04-22 02:15
fff3cc86687f922d106960abdbc7d7dde0b7c957 patch · browse files
parent e58766215ba4d447832491e8a1e5db02b51f599e

Use lean_and_mean, add missing headers

WIN32_LEAN_AND_MEAN makes <windows.h> bring in a lot less junk.
SUCCEEDED macro in winerror.h is used.
Stringapiset.h is needed for WideCharToMultiByte.

Changed files

M sago/platform_folders.cpp before
diff --git a/sago/platform_folders.cpp b/sago/platform_folders.cpp index 25e9c43..d170d97 100644 --- a/sago/platform_folders.cpp +++ b/sago/platform_folders.cpp
@@ -33,7 +33,17 @@ SOFTWARE.
#include <cstdlib>
#ifdef _WIN32
+// Make sure we don't bring in all the extra junk with windows.h
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+// stringapiset.h depends on this
#include <windows.h>
+// For SUCCEEDED macro
+#include <winerror.h>
+// For WideCharToMultiByte
+#include <stringapiset.h>
+// For SHGetFolderPathW and various CSIDL "magic numbers"
#include <shlobj.h>
static std::string win32_utf16_to_utf8(const wchar_t* wstr)