commit 2027da9e09f6acc760f10c7ba973dddb014a7738 Author: Tomás Touceda chiiph@torproject.org Date: Thu Aug 9 21:56:19 2012 -0300
Use ControlPortWriteToFile as a relative path instead of absolute --- changes/bug6568 | 2 ++ src/vidalia/MainWindow.cpp | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/changes/bug6568 b/changes/bug6568 new file mode 100644 index 0000000..a1273fa --- /dev/null +++ b/changes/bug6568 @@ -0,0 +1,2 @@ + o Save ControlPortWriteToFile with a relative path instead of an absolute + one. Fixes bug 6568. diff --git a/src/vidalia/MainWindow.cpp b/src/vidalia/MainWindow.cpp index a7a4a09..fef48ec 100644 --- a/src/vidalia/MainWindow.cpp +++ b/src/vidalia/MainWindow.cpp @@ -1124,13 +1124,26 @@ MainWindow::start()
if(settings.getControlMethod() == ControlMethod::Port) { if(settings.autoControlPort()) { + QString dataDirectory = settings.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 = settings.getExecutable(); + if(QDir(torPath).isRelative()) + torPath = QCoreApplication::applicationDirPath() + "/" + torPath; + relativePortConf = QDir(torPath).relativeFilePath(QString("%1/port.conf").arg(dataDirectory)); +#endif QString portconf = QString("%1/port.conf").arg(expDataDirectory); if(!QFile::remove(portconf)) vWarn(QString("Unable to remove %1, may be it didn't existed.").arg(portconf));
args << "ControlPort" << "auto"; args << "SocksPort" << "auto"; - args << "ControlPortWriteToFile" << portconf; + args << "ControlPortWriteToFile" << relativePortConf; } else { /* Add the intended control port value */ quint16 controlPort = settings.getControlPort();
tor-commits@lists.torproject.org