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

[vidalia-svn] r1880: Check to see if "%PROGRAMFILES%\Vidalia Bundle\Tor\tor.exe" (trunk/src/config)



Author: edmanm
Date: 2007-08-26 00:14:26 -0400 (Sun, 26 Aug 2007)
New Revision: 1880

Modified:
   trunk/src/config/torsettings.cpp
Log:
Check to see if "%PROGRAMFILES%\Vidalia Bundle\Tor\tor.exe" exists when
setting the default Tor executable on Win32. If it doesn't, fall back to
"%PROGRAMFILES%\Tor\tor.exe". Fixes Ticket #262.


Modified: trunk/src/config/torsettings.cpp
===================================================================
--- trunk/src/config/torsettings.cpp	2007-08-26 03:51:15 UTC (rev 1879)
+++ trunk/src/config/torsettings.cpp	2007-08-26 04:14:26 UTC (rev 1880)
@@ -48,10 +48,8 @@
 
 /* On win32, we need to add the .exe onto Tor's filename */
 #if defined(Q_OS_WIN32)
+#include <QFileInfo>
 #include <util/win32.h>
-#define DEFAULT_TOR_EXECUTABLE    (win32_program_files_folder() + "\\Tor\\tor.exe")
-#else
-#define DEFAULT_TOR_EXECUTABLE    "tor"
 #endif
 
 /** Default to using hashed password authentication */
@@ -73,7 +71,16 @@
 /** Default constructor */
 TorSettings::TorSettings()
 {
-  setDefault(SETTING_TOR_EXECUTABLE, DEFAULT_TOR_EXECUTABLE);
+#if defined(Q_OS_WIN32)
+  QString programFiles = win32_program_files_folder();
+  if (QFileInfo(programFiles + "\\Vidalia Bundle\\Tor\\tor.exe").exists())
+    setDefault(SETTING_TOR_EXECUTABLE, programFiles + "\\Vidalia Bundle\\Tor\\tor.exe");
+  else
+    setDefault(SETTING_TOR_EXECUTABLE, programFiles + "\\Tor\\tor.exe");
+#else
+  setDefault(SETTING_TOR_EXECUTABLE, "tor");
+#endif
+
   setDefault(SETTING_TORRC,         Vidalia::dataDirectory() + "/torrc");
   setDefault(SETTING_CONTROL_ADDR,  "127.0.0.1");
   setDefault(SETTING_CONTROL_PORT,  9051);