From 8311f4e2e43af11439fa3fd79377591d67de738a Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Mon, 7 Feb 2011 10:45:50 +0000 Subject: [PATCH] [Bugfix] win vncviewer: create VNC home directory during startup. Thanks to Guillaume Destuynder. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4253 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- win/vncviewer/vncviewer.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/win/vncviewer/vncviewer.cxx b/win/vncviewer/vncviewer.cxx index f861e796..1c68808a 100644 --- a/win/vncviewer/vncviewer.cxx +++ b/win/vncviewer/vncviewer.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -220,6 +221,17 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prevInst, char* cmdLine, int cmdSho programInfo(); + // Create vnc in the user's home directory if it doesn't already exist + char* homeDir = NULL; + if (getvnchomedir(&homeDir) == -1) + vlog.error("Could not create vnc directory: can't obtain home directory path"); + else { + int result = CreateDirectory(homeDir, NULL); + if (result <= 0 && GetLastError() != ERROR_ALREADY_EXISTS) + vlog.error("Could not create vnc directory: %u", GetLastError()); + delete [] homeDir; + } + // - Connect to the clients if (!configFiles.empty() || !hosts.empty() || acceptIncoming) { // - Configure the registry configuration reader -- 2.39.5