[tor-commits] [vidalia/alpha] Save ControlPortWriteToFile as a relative path
chiiph at torproject.org
chiiph at torproject.org
Fri Aug 10 01:01:22 UTC 2012
commit 2ae3295b11a427b6e7ea0117645159501a0f1067
Author: Tomás Touceda <chiiph at torproject.org>
Date: Thu Aug 9 20:27:38 2012 -0300
Save ControlPortWriteToFile as a relative path
---
changes/bug6568 | 3 +++
src/vidalia/config/TorSettings.cpp | 17 ++++++++++++++++-
2 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/changes/bug6568 b/changes/bug6568
new file mode 100644
index 0000000..abddba4
--- /dev/null
+++ b/changes/bug6568
@@ -0,0 +1,3 @@
+ Bug fixes relative to 0.2.x:
+ o Save ControlPortWriteToFile with a relative path instead of an absolute
+ one. Fixes bug 6568.
diff --git a/src/vidalia/config/TorSettings.cpp b/src/vidalia/config/TorSettings.cpp
index 25de975..b83b1da 100644
--- a/src/vidalia/config/TorSettings.cpp
+++ b/src/vidalia/config/TorSettings.cpp
@@ -115,7 +115,22 @@ TorSettings::apply(QString *errmsg)
if(volatileValue(SETTING_AUTOCONTROL).toBool()) {
torrc->setValue(SETTING_CONTROL_PORT, "auto");
torrc->setValue(SETTING_SOCKS_PORT, "auto");
- torrc->setValue(TOR_ARG_CONTROLFILE, QString("%1/port.conf").arg(getDataDirectory()));
+
+ QString dataDirectory = getDataDirectory();
+ if(QDir(dataDirectory).isRelative())
+ dataDirectory = QCoreApplication::applicationDirPath() + "/" + dataDirectory;
+
+ QString relativePortConf = QDir(QDir::currentPath())
+ .relativeFilePath(QString("%1/port.conf").arg(dataDirectory));
+
+#if defined(Q_WS_WIN)
+ QString torPath = getExecutable();
+ if(QDir(torPath).isRelative())
+ torPath = QCoreApplication::applicationDirPath() + "/" + torPath;
+ relativePortConf = QDir(torPath).relativeFilePath(QString("%1/port.conf").arg(dataDirectory));
+#endif
+
+ torrc->setValue(TOR_ARG_CONTROLFILE, relativePortConf);
} else {
QString socks = volatileValue(SETTING_SOCKS_PORT).toString();
QString control = volatileValue(SETTING_CONTROL_PORT).toString();
More information about the tor-commits
mailing list