]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/mainframe.cpp
q3map2: use "My Games" directory if exists on Win32
[xonotic/netradiant.git] / radiant / mainframe.cpp
index c8a739b6f6939952f32845849e74b8c5b6252d5e..85aaaee75b0c1487ac85b53d0d3d02827b080ffb 100644 (file)
@@ -196,6 +196,26 @@ void HomePaths_Realise()
     Q_mkdir(g_qeglobals.m_userEnginePath.c_str());
   }
   else
+#elif defined(WIN32)
+  if(!string_empty(prefix))
+  {
+    StringOutputStream path(256);
+    TCHAR mydocsdir[MAX_PATH + 1];
+    if(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, mydocsdir))
+    {
+      path << DirectoryCleaned(mydocsdir) << "My Games/" << prefix << "/";
+      // win32: only add it if it already exists
+      if(file_is_directory(path.c_str()))
+        g_qeglobals.m_userEnginePath = path.c_str();
+      else
+        g_qeglobals.m_userEnginePath = EnginePath_get();
+    }
+    else
+    {
+      g_qeglobals.m_userEnginePath = EnginePath_get();
+    }
+  }
+  else
 #endif
   {
     g_qeglobals.m_userEnginePath = EnginePath_get();