]> source.dussan.org Git - tigervnc.git/commitdiff
[Bugfix] win vncviewer: create VNC home directory during startup.
authorAdam Tkac <atkac@redhat.com>
Mon, 7 Feb 2011 10:45:50 +0000 (10:45 +0000)
committerAdam Tkac <atkac@redhat.com>
Mon, 7 Feb 2011 10:45:50 +0000 (10:45 +0000)
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

index f861e796b37f009ff6a04173477c9f7ed2607f44..1c68808a42eaff097625db00c5733562148d21d7 100644 (file)
@@ -31,6 +31,7 @@
 #include <vncviewer/OptionsDialog.h>
 #include <vncviewer/ListenTrayIcon.h>
 #include <network/TcpSocket.h>
+#include <os/os.h>
 #include <rfb/Logger_stdio.h>
 #include <rfb/Logger_file.h>
 #include <rfb/LogWriter.h>
@@ -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