remove DataDirectory wrappers in ArchFile*
This commit is contained in:
parent
d81054ab6e
commit
6c5acdd552
|
@ -38,27 +38,12 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual const char* getBasename(const char* pathname) = 0;
|
virtual const char* getBasename(const char* pathname) = 0;
|
||||||
|
|
||||||
//! Get user's home directory
|
|
||||||
/*!
|
|
||||||
Returns the user's home directory. Returns the empty string if
|
|
||||||
this cannot be determined.
|
|
||||||
*/
|
|
||||||
virtual std::string getUserDirectory() = 0;
|
|
||||||
|
|
||||||
//! Get system directory
|
//! Get system directory
|
||||||
/*!
|
/*!
|
||||||
Returns the ussystem configuration file directory.
|
Returns the ussystem configuration file directory.
|
||||||
*/
|
*/
|
||||||
virtual std::string getSystemDirectory() = 0;
|
virtual std::string getSystemDirectory() = 0;
|
||||||
|
|
||||||
//! Get user's profile directory
|
|
||||||
/*!
|
|
||||||
Returns the user's profile directory. If no profile directory is set,
|
|
||||||
this will return the user's profile according to the operating system,
|
|
||||||
which will depend on which user launched the program.
|
|
||||||
*/
|
|
||||||
virtual std::string getProfileDirectory() = 0;
|
|
||||||
|
|
||||||
//! Concatenate path components
|
//! Concatenate path components
|
||||||
/*!
|
/*!
|
||||||
Concatenate pathname components with a directory separator
|
Concatenate pathname components with a directory separator
|
||||||
|
@ -69,11 +54,4 @@ public:
|
||||||
virtual std::string concatPath(
|
virtual std::string concatPath(
|
||||||
const std::string& prefix,
|
const std::string& prefix,
|
||||||
const std::string& suffix) = 0;
|
const std::string& suffix) = 0;
|
||||||
|
|
||||||
//@}
|
|
||||||
//! Set the user's profile directory
|
|
||||||
/*
|
|
||||||
Returns the user's profile directory.
|
|
||||||
*/
|
|
||||||
virtual void setProfileDirectory(const String& s) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,16 +29,6 @@
|
||||||
// ArchFileUnix
|
// ArchFileUnix
|
||||||
//
|
//
|
||||||
|
|
||||||
ArchFileUnix::ArchFileUnix()
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
ArchFileUnix::~ArchFileUnix()
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
ArchFileUnix::getBasename(const char* pathname)
|
ArchFileUnix::getBasename(const char* pathname)
|
||||||
{
|
{
|
||||||
|
@ -55,24 +45,12 @@ ArchFileUnix::getBasename(const char* pathname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
|
||||||
ArchFileUnix::getUserDirectory()
|
|
||||||
{
|
|
||||||
return DataDirectories::personal();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
ArchFileUnix::getSystemDirectory()
|
ArchFileUnix::getSystemDirectory()
|
||||||
{
|
{
|
||||||
return "/etc";
|
return "/etc";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
|
||||||
ArchFileUnix::getProfileDirectory()
|
|
||||||
{
|
|
||||||
return DataDirectories::profile();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
ArchFileUnix::concatPath(const std::string& prefix,
|
ArchFileUnix::concatPath(const std::string& prefix,
|
||||||
const std::string& suffix)
|
const std::string& suffix)
|
||||||
|
@ -86,15 +64,3 @@ ArchFileUnix::concatPath(const std::string& prefix,
|
||||||
path += suffix;
|
path += suffix;
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ArchFileUnix::setProfileDirectory(const String& s)
|
|
||||||
{
|
|
||||||
DataDirectories::profile(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ArchFileUnix::setPluginDirectory(const String& s)
|
|
||||||
{
|
|
||||||
m_pluginDirectory = s;
|
|
||||||
}
|
|
||||||
|
|
|
@ -25,19 +25,9 @@
|
||||||
//! Unix implementation of IArchFile
|
//! Unix implementation of IArchFile
|
||||||
class ArchFileUnix : public IArchFile {
|
class ArchFileUnix : public IArchFile {
|
||||||
public:
|
public:
|
||||||
ArchFileUnix();
|
|
||||||
virtual ~ArchFileUnix();
|
|
||||||
|
|
||||||
// IArchFile overrides
|
// IArchFile overrides
|
||||||
virtual const char* getBasename(const char* pathname);
|
virtual const char* getBasename(const char* pathname);
|
||||||
virtual std::string getUserDirectory();
|
|
||||||
virtual std::string getSystemDirectory();
|
virtual std::string getSystemDirectory();
|
||||||
virtual std::string getProfileDirectory();
|
|
||||||
virtual std::string concatPath(const std::string& prefix,
|
virtual std::string concatPath(const std::string& prefix,
|
||||||
const std::string& suffix);
|
const std::string& suffix);
|
||||||
virtual void setProfileDirectory(const String& s);
|
|
||||||
virtual void setPluginDirectory(const String& s);
|
|
||||||
|
|
||||||
private:
|
|
||||||
String m_pluginDirectory;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,12 +54,6 @@ ArchFileWindows::getBasename(const char* pathname)
|
||||||
return basename;
|
return basename;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
|
||||||
ArchFileWindows::getUserDirectory()
|
|
||||||
{
|
|
||||||
return DataDirectories::personal();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
ArchFileWindows::getSystemDirectory()
|
ArchFileWindows::getSystemDirectory()
|
||||||
{
|
{
|
||||||
|
@ -74,12 +68,6 @@ ArchFileWindows::getSystemDirectory()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
|
||||||
ArchFileWindows::getProfileDirectory()
|
|
||||||
{
|
|
||||||
return DataDirectories::profile();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
ArchFileWindows::concatPath(const std::string& prefix,
|
ArchFileWindows::concatPath(const std::string& prefix,
|
||||||
const std::string& suffix)
|
const std::string& suffix)
|
||||||
|
@ -95,9 +83,3 @@ ArchFileWindows::concatPath(const std::string& prefix,
|
||||||
path += suffix;
|
path += suffix;
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ArchFileWindows::setProfileDirectory(const String& s)
|
|
||||||
{
|
|
||||||
DataDirectories::profile(s);
|
|
||||||
}
|
|
||||||
|
|
|
@ -27,10 +27,7 @@ class ArchFileWindows : public IArchFile {
|
||||||
public:
|
public:
|
||||||
// IArchFile overrides
|
// IArchFile overrides
|
||||||
virtual const char* getBasename(const char* pathname);
|
virtual const char* getBasename(const char* pathname);
|
||||||
virtual std::string getUserDirectory();
|
|
||||||
virtual std::string getSystemDirectory();
|
virtual std::string getSystemDirectory();
|
||||||
virtual std::string getProfileDirectory();
|
|
||||||
virtual std::string concatPath(const std::string& prefix,
|
virtual std::string concatPath(const std::string& prefix,
|
||||||
const std::string& suffix);
|
const std::string& suffix);
|
||||||
virtual void setProfileDirectory(const String& s);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,9 +21,7 @@
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
#include "common/Version.h"
|
#include "common/Version.h"
|
||||||
#include "barrier/protocol_types.h"
|
#include "barrier/protocol_types.h"
|
||||||
#include "arch/Arch.h"
|
|
||||||
#include "base/XBase.h"
|
#include "base/XBase.h"
|
||||||
#include "arch/XArch.h"
|
|
||||||
#include "base/log_outputters.h"
|
#include "base/log_outputters.h"
|
||||||
#include "barrier/XBarrier.h"
|
#include "barrier/XBarrier.h"
|
||||||
#include "barrier/ArgsBase.h"
|
#include "barrier/ArgsBase.h"
|
||||||
|
@ -32,9 +30,9 @@
|
||||||
#include "ipc/IpcMessage.h"
|
#include "ipc/IpcMessage.h"
|
||||||
#include "ipc/Ipc.h"
|
#include "ipc/Ipc.h"
|
||||||
#include "base/EventQueue.h"
|
#include "base/EventQueue.h"
|
||||||
|
#include "common/DataDirectories.h"
|
||||||
|
|
||||||
#if SYSAPI_WIN32
|
#if SYSAPI_WIN32
|
||||||
#include "arch/win32/ArchMiscWindows.h"
|
|
||||||
#include "base/IEventQueue.h"
|
#include "base/IEventQueue.h"
|
||||||
#include "base/TMethodJob.h"
|
#include "base/TMethodJob.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -175,7 +173,7 @@ App::initApp(int argc, const char** argv)
|
||||||
// parse command line
|
// parse command line
|
||||||
parseArgs(argc, argv);
|
parseArgs(argc, argv);
|
||||||
|
|
||||||
ARCH->setProfileDirectory(argsBase().m_profileDirectory);
|
DataDirectories::profile(argsBase().m_profileDirectory);
|
||||||
|
|
||||||
// set log filter
|
// set log filter
|
||||||
if (!CLOG->setFilter(argsBase().m_logFilter)) {
|
if (!CLOG->setFilter(argsBase().m_logFilter)) {
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
#include "base/TMethodEventJob.h"
|
#include "base/TMethodEventJob.h"
|
||||||
#include "common/Version.h"
|
#include "common/Version.h"
|
||||||
|
#include "common/DataDirectories.h"
|
||||||
|
|
||||||
#if SYSAPI_WIN32
|
#if SYSAPI_WIN32
|
||||||
#include "arch/win32/ArchMiscWindows.h"
|
#include "arch/win32/ArchMiscWindows.h"
|
||||||
|
@ -181,7 +182,7 @@ ServerApp::loadConfig()
|
||||||
// load the default configuration if no explicit file given
|
// load the default configuration if no explicit file given
|
||||||
else {
|
else {
|
||||||
// get the user's home directory
|
// get the user's home directory
|
||||||
String path = ARCH->getUserDirectory();
|
String path = DataDirectories::personal();
|
||||||
if (!path.empty()) {
|
if (!path.empty()) {
|
||||||
// complete path
|
// complete path
|
||||||
path = ARCH->concatPath(path, USR_CONFIG_NAME);
|
path = ARCH->concatPath(path, USR_CONFIG_NAME);
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "net/SocketMultiplexer.h"
|
#include "net/SocketMultiplexer.h"
|
||||||
#include "net/TSocketMultiplexerMethodJob.h"
|
#include "net/TSocketMultiplexerMethodJob.h"
|
||||||
#include "arch/XArch.h"
|
#include "arch/XArch.h"
|
||||||
|
#include "common/DataDirectories.h"
|
||||||
|
|
||||||
static const char s_certificateDir[] = { "SSL" };
|
static const char s_certificateDir[] = { "SSL" };
|
||||||
static const char s_certificateFilename[] = { "Barrier.pem" };
|
static const char s_certificateFilename[] = { "Barrier.pem" };
|
||||||
|
@ -54,7 +55,7 @@ SecureListenSocket::accept()
|
||||||
}
|
}
|
||||||
|
|
||||||
String certificateFilename = barrier::string::sprintf("%s/%s/%s",
|
String certificateFilename = barrier::string::sprintf("%s/%s/%s",
|
||||||
ARCH->getProfileDirectory().c_str(),
|
DataDirectories::profile().c_str(),
|
||||||
s_certificateDir,
|
s_certificateDir,
|
||||||
s_certificateFilename);
|
s_certificateFilename);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "mt/Lock.h"
|
#include "mt/Lock.h"
|
||||||
#include "arch/XArch.h"
|
#include "arch/XArch.h"
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
|
#include "common/DataDirectories.h"
|
||||||
|
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
|
@ -699,7 +700,7 @@ SecureSocket::verifyCertFingerprint()
|
||||||
String trustedServersFilename;
|
String trustedServersFilename;
|
||||||
trustedServersFilename = barrier::string::sprintf(
|
trustedServersFilename = barrier::string::sprintf(
|
||||||
"%s/%s/%s",
|
"%s/%s/%s",
|
||||||
ARCH->getProfileDirectory().c_str(),
|
DataDirectories::profile().c_str(),
|
||||||
kFingerprintDirName,
|
kFingerprintDirName,
|
||||||
kFingerprintTrustedServersFilename);
|
kFingerprintTrustedServersFilename);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue