mirror of
https://github.com/RetroShare/RetroShare.git
synced 2026-09-12 19:50:17 +05:00
Moved tor data directory for gui to account directory so that we can run multiple tor instances simultaneously
This commit is contained in:
parent
9e92faad7c
commit
2c9fcd0c57
@ -589,9 +589,10 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
|
||||
// Now that we know the Tor service running, and we know the SSL id, we can make sure it provides a viable hidden service
|
||||
|
||||
std::string tor_hidden_service_dir = RsAccounts::AccountDirectory() + "/hidden_service/" ;
|
||||
std::string account_directory = RsAccounts::AccountDirectory();
|
||||
std::string tor_hidden_service_dir = account_directory + "/hidden_service/" ;
|
||||
|
||||
RsTor::setTorDataDirectory(RsApplication::dataDirectory().toStdString() + "/tor/");
|
||||
RsTor::setTorDataDirectory(account_directory + "/tor/");
|
||||
RsTor::setHiddenServiceDirectory(tor_hidden_service_dir); // re-set it, because now it's changed to the specific location that is run
|
||||
|
||||
RsDirUtil::checkCreateDirectory(std::string(tor_hidden_service_dir)) ;
|
||||
|
||||
@ -559,41 +559,6 @@ void RsApplication::initPlugins()
|
||||
LanguageSupport::translatePlugins(options.language);
|
||||
}
|
||||
|
||||
/** Returns the directory RetroShare uses for its data files. */
|
||||
QString RsApplication::dataDirectory()
|
||||
{
|
||||
if(!options.optBaseDir.empty())
|
||||
return QString::fromUtf8(options.optBaseDir.c_str());
|
||||
else
|
||||
return defaultDataDirectory();
|
||||
}
|
||||
|
||||
/** Returns the default location of RetroShare's data directory. */
|
||||
QString
|
||||
RsApplication::defaultDataDirectory()
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
return (win32_app_data_folder() + "\\RetroShare");
|
||||
#else
|
||||
return (QDir::homePath() + "/.retroshare");
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Creates RsApplication's data directory, if it doesn't already exist. */
|
||||
bool
|
||||
RsApplication::createDataDirectory(QString *errmsg)
|
||||
{
|
||||
QDir datadir(dataDirectory());
|
||||
if (!datadir.exists()) {
|
||||
QString path = datadir.absolutePath();
|
||||
if (!datadir.mkpath(path)) {
|
||||
return err(errmsg,
|
||||
tr("Could not create data directory: %1").arg(path));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Set RsApplication's data directory - externally */
|
||||
bool RsApplication::setConfigDirectory(const QString& dir)
|
||||
{
|
||||
|
||||
@ -132,13 +132,6 @@ public:
|
||||
/** Returns Rshare's application startup time. */
|
||||
static QDateTime startupTime();
|
||||
|
||||
/** Returns the location Rshare uses for its data files. */
|
||||
static QString dataDirectory();
|
||||
/** Returns the default location of Rshare's data directory. */
|
||||
static QString defaultDataDirectory();
|
||||
/** Creates Rshare's data directory, if it doesn't already exist. */
|
||||
static bool createDataDirectory(QString *errmsg);
|
||||
|
||||
/** Writes <b>msg</b> with severity <b>level</b> to RetroShare's log. */
|
||||
static Log::LogMessage log(Log::LogLevel level, QString msg);
|
||||
|
||||
|
||||
@ -30,39 +30,8 @@
|
||||
#include <shlobj.h>
|
||||
#endif
|
||||
|
||||
#include <QDir>
|
||||
#include "retroshareWin32.h"
|
||||
|
||||
|
||||
/** Finds the location of the "special" Windows folder using the given CSIDL
|
||||
* value. If the folder cannot be found, the given default path is used. */
|
||||
QString
|
||||
win32_get_folder_location(int /*folder*/, QString defaultPath)
|
||||
{
|
||||
#if 0
|
||||
TCHAR path[MAX_PATH+1];
|
||||
LPITEMIDLIST idl;
|
||||
IMalloc *m;
|
||||
HRESULT result;
|
||||
|
||||
/* Find the location of %PROGRAMFILES% */
|
||||
if (SUCCEEDED(SHGetSpecialFolderLocation(NULL, folder, &idl))) {
|
||||
/* Get the path from the IDL */
|
||||
result = SHGetPathFromIDList(idl, path);
|
||||
SHGetMalloc(&m);
|
||||
if (m) {
|
||||
m->Release();
|
||||
}
|
||||
if (SUCCEEDED(result)) {
|
||||
QT_WA(return QString::fromUtf16((const ushort *)path);,
|
||||
return QString::fromLocal8Bit((char *)path);)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return defaultPath;
|
||||
}
|
||||
|
||||
/** Returns the value in keyName at keyLocation.
|
||||
* Returns an empty QString if the keyName doesn't exist */
|
||||
QString
|
||||
@ -151,31 +120,3 @@ win32_registry_remove_key(QString keyLocation, QString keyName)
|
||||
Q_UNUSED(keyName);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Gets the location of the user's %PROGRAMFILES% folder. */
|
||||
QString
|
||||
win32_program_files_folder()
|
||||
{
|
||||
return win32_get_folder_location(
|
||||
#if 0
|
||||
CSIDL_PROGRAM_FILES,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
QDir::rootPath() + "\\Program Files");
|
||||
}
|
||||
|
||||
/** Gets the location of the user's %APPDATA% folder. */
|
||||
QString
|
||||
win32_app_data_folder()
|
||||
{
|
||||
return win32_get_folder_location(
|
||||
#if 0
|
||||
CSIDL_APPDATA,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
QDir::homePath() + "\\Application Data");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -21,15 +21,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QHash>
|
||||
#include <QString>
|
||||
|
||||
/** Retrieves the location of the user's %PROGRAMFILES% folder. */
|
||||
QString win32_program_files_folder();
|
||||
|
||||
/** Retrieves the location of the user's %APPDATA% folder. */
|
||||
QString win32_app_data_folder();
|
||||
|
||||
/** Returns value of keyName or empty QString if keyName doesn't exist */
|
||||
QString win32_registry_get_key_value(QString keyLocation, QString keyName);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user