[X2Go-Commits] [x2goclient] 221/280: src/onmainwindow.cpp: refactor generateKey () a little bit to compact it.

git-admin at x2go.org git-admin at x2go.org
Wed Jan 18 12:26:02 CET 2017


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 994a1290f80933f6f3963076a79694f5a9854c30
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Sep 22 05:32:59 2016 +0200

    src/onmainwindow.cpp: refactor generateKey () a little bit to compact it.
---
 debian/changelog     |    2 ++
 src/onmainwindow.cpp |   19 ++++++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c132511..e1bff32 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -410,6 +410,8 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
     - src/onmainwindow.{cpp,h}: rename generateHostKey () to generateKey ()
       and add a boolean parameter with a default of false to request a public
       key. Change old invocations of generateHostKey () accordingly.
+    - src/onmainwindow.cpp: refactor generateKey () a little bit to compact
+      it.
 
   [ Bernard Cafarelli ]
   * New upstream version (4.0.5.3):
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index eef7633..e3802f5 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -10391,21 +10391,22 @@ void ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_key)
         close ();
     }
 
-    QString etcDir = homeDir + "/.x2go/etc/";
-    QDir dr (homeDir);
-    dr.mkpath (etcDir);
-    QString private_key_file = etcDir + "/ssh_host_" + stringified_key_type + "_key";
+    QString etc_dir = homeDir + "/.x2go/etc/";
+    QDir dir (homeDir);
+    dir.mkpath (etc_dir);
+    QString private_key_file = "";
+#ifdef Q_OS_WIN
+    private_key_file = cygwinPath (wapiShortFileName (etc_dir));
+#else
+    private_key_file = etc_dir;
+#endif
+    private_key_file += "/ssh_host_" + stringified_key_type + "_key";
     QString public_key_file = private_key_file + ".pub";
 
     if ((!(QFile::exists (private_key_file))) || (!(QFile::exists (public_key_file))))
     {
         x2goDebug << "Generating host key. Type: " << stringified_key_type;
 
-#ifdef Q_OS_WIN
-        private_key_file = cygwinPath (wapiShortFileName (etcDir))
-                         + "/ssh_host_" + stringified_key_type + "_key";
-#endif
-
         QStringList args;
         args << "-t"
              << stringified_key_type

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list