[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r1783: Add /usr/sbin to $PATH (if we're not on Windows) before tryi (in trunk: . src/control)



Author: edmanm
Date: 2007-06-12 22:33:57 -0400 (Tue, 12 Jun 2007)
New Revision: 1783

Modified:
   trunk/
   trunk/src/control/torprocess.cpp
Log:
 r1913@adrastea:  edmanm | 2007-06-12 22:33:38 -0400
 Add /usr/sbin to $PATH (if we're not on Windows) before trying to launch
 Tor, so we can hopefully find a Tor binary on Debian/Ubuntu.



Property changes on: trunk
___________________________________________________________________
 svk:merge ticket from /vidalia/local/trunk [r1913] on 54b3572a-7227-0410-958f-53ecd705b71a

Modified: trunk/src/control/torprocess.cpp
===================================================================
--- trunk/src/control/torprocess.cpp	2007-06-13 00:10:57 UTC (rev 1782)
+++ trunk/src/control/torprocess.cpp	2007-06-13 02:33:57 UTC (rev 1783)
@@ -61,7 +61,19 @@
   app = app + " " + args;
   
   /* Attempt to start Tor with the given command-line arguments */
-  setEnvironment(QProcess::systemEnvironment());
+  QStringList env = QProcess::systemEnvironment();
+#if !defined(Q_OS_WIN32)
+  /* Add "/usr/sbin" to an existing $PATH
+   * XXX What if they have no path? Would always just making one with 
+   *     "/usr/sbin" smart? Should we add anything else? */
+  for (int i = 0; i < env.size(); i++) {
+    QString envVar = env.at(i);
+    if (envVar.startsWith("PATH="))
+      env.replace(i, envVar += ":/usr/sbin");
+  }
+#endif
+  setEnvironment(env);
+
   vNotice("Starting Tor using '%1'").arg(app);
   QProcess::start(app, QIODevice::ReadOnly | QIODevice::Text);
 }