summaryrefslogtreecommitdiffstats
path: root/client/windows/platform.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'client/windows/platform.cpp')
-rw-r--r--client/windows/platform.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp
index 2988827d..8aba5d11 100644
--- a/client/windows/platform.cpp
+++ b/client/windows/platform.cpp
@@ -17,6 +17,8 @@
#include "common.h"
+#include <shlobj.h>
+
#include "platform.h"
#include "win_platform.h"
#include "utils.h"
@@ -28,6 +30,8 @@
#include "cursor.h"
#include "named_pipe.h"
+#define SPICE_CONFIG_DIR "spicec\\"
+
int gdi_handlers = 0;
extern HINSTANCE instance;
@@ -427,6 +431,21 @@ bool Platform::is_monitors_pos_valid()
return true;
}
+void Platform::get_spice_config_dir(std::string& path)
+{
+ char app_data_path[MAX_PATH];
+ HRESULT res = SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, app_data_path);
+ if (res != S_OK) {
+ throw Exception("get user app data dir failed");
+ }
+
+ path = app_data_path;
+ if (strcmp((app_data_path + strlen(app_data_path) - 2), "\\") != 0) {
+ path += "\\";
+ }
+ path += SPICE_CONFIG_DIR;
+}
+
void Platform::init()
{
create_message_wind();