mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-23 19:12:14 +03:00
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;
|
||||
|
||||
//! 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
|
||||
/*!
|
||||
Returns the ussystem configuration file directory.
|
||||
*/
|
||||
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 pathname components with a directory separator
|
||||
@ -69,11 +54,4 @@ public:
|
||||
virtual std::string concatPath(
|
||||
const std::string& prefix,
|
||||
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()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
ArchFileUnix::~ArchFileUnix()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
const char*
|
||||
ArchFileUnix::getBasename(const char* pathname)
|
||||
{
|
||||
@ -55,24 +45,12 @@ ArchFileUnix::getBasename(const char* pathname)
|
||||
}
|
||||
}
|
||||
|
||||
std::string
|
||||
ArchFileUnix::getUserDirectory()
|
||||
{
|
||||
return DataDirectories::personal();
|
||||
}
|
||||
|
||||
std::string
|
||||
ArchFileUnix::getSystemDirectory()
|
||||
{
|
||||
return "/etc";
|
||||
}
|
||||
|
||||
std::string
|
||||
ArchFileUnix::getProfileDirectory()
|
||||
{
|
||||
return DataDirectories::profile();
|
||||
}
|
||||
|
||||
std::string
|
||||
ArchFileUnix::concatPath(const std::string& prefix,
|
||||
const std::string& suffix)
|
||||
@ -86,15 +64,3 @@ ArchFileUnix::concatPath(const std::string& prefix,
|
||||
path += suffix;
|
||||
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
|
||||
class ArchFileUnix : public IArchFile {
|
||||
public:
|
||||
ArchFileUnix();
|
||||
virtual ~ArchFileUnix();
|
||||
|
||||
// IArchFile overrides
|
||||
virtual const char* getBasename(const char* pathname);
|
||||
virtual std::string getUserDirectory();
|
||||
virtual std::string getSystemDirectory();
|
||||
virtual std::string getProfileDirectory();
|
||||
virtual std::string concatPath(const std::string& prefix,
|
||||
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;
|
||||
}
|
||||
|
||||
std::string
|
||||
ArchFileWindows::getUserDirectory()
|
||||
{
|
||||
return DataDirectories::personal();
|
||||
}
|
||||
|
||||
std::string
|
||||
ArchFileWindows::getSystemDirectory()
|
||||
{
|
||||
@ -74,12 +68,6 @@ ArchFileWindows::getSystemDirectory()
|
||||
}
|
||||
}
|
||||
|
||||
std::string
|
||||
ArchFileWindows::getProfileDirectory()
|
||||
{
|
||||
return DataDirectories::profile();
|
||||
}
|
||||
|
||||
std::string
|
||||
ArchFileWindows::concatPath(const std::string& prefix,
|
||||
const std::string& suffix)
|
||||
@ -95,9 +83,3 @@ ArchFileWindows::concatPath(const std::string& prefix,
|
||||
path += suffix;
|
||||
return path;
|
||||
}
|
||||
|
||||
void
|
||||
ArchFileWindows::setProfileDirectory(const String& s)
|
||||
{
|
||||
DataDirectories::profile(s);
|
||||
}
|
||||
|
@ -27,10 +27,7 @@ class ArchFileWindows : public IArchFile {
|
||||
public:
|
||||
// IArchFile overrides
|
||||
virtual const char* getBasename(const char* pathname);
|
||||
virtual std::string getUserDirectory();
|
||||
virtual std::string getSystemDirectory();
|
||||
virtual std::string getProfileDirectory();
|
||||
virtual std::string concatPath(const std::string& prefix,
|
||||
const std::string& suffix);
|
||||
virtual void setProfileDirectory(const String& s);
|
||||
};
|
||||
|
@ -21,9 +21,7 @@
|
||||
#include "base/Log.h"
|
||||
#include "common/Version.h"
|
||||
#include "barrier/protocol_types.h"
|
||||
#include "arch/Arch.h"
|
||||
#include "base/XBase.h"
|
||||
#include "arch/XArch.h"
|
||||
#include "base/log_outputters.h"
|
||||
#include "barrier/XBarrier.h"
|
||||
#include "barrier/ArgsBase.h"
|
||||
@ -32,9 +30,9 @@
|
||||
#include "ipc/IpcMessage.h"
|
||||
#include "ipc/Ipc.h"
|
||||
#include "base/EventQueue.h"
|
||||
#include "common/DataDirectories.h"
|
||||
|
||||
#if SYSAPI_WIN32
|
||||
#include "arch/win32/ArchMiscWindows.h"
|
||||
#include "base/IEventQueue.h"
|
||||
#include "base/TMethodJob.h"
|
||||
#endif
|
||||
@ -175,7 +173,7 @@ App::initApp(int argc, const char** argv)
|
||||
// parse command line
|
||||
parseArgs(argc, argv);
|
||||
|
||||
ARCH->setProfileDirectory(argsBase().m_profileDirectory);
|
||||
DataDirectories::profile(argsBase().m_profileDirectory);
|
||||
|
||||
// set log filter
|
||||
if (!CLOG->setFilter(argsBase().m_logFilter)) {
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "base/Log.h"
|
||||
#include "base/TMethodEventJob.h"
|
||||
#include "common/Version.h"
|
||||
#include "common/DataDirectories.h"
|
||||
|
||||
#if SYSAPI_WIN32
|
||||
#include "arch/win32/ArchMiscWindows.h"
|
||||
@ -181,7 +182,7 @@ ServerApp::loadConfig()
|
||||
// load the default configuration if no explicit file given
|
||||
else {
|
||||
// get the user's home directory
|
||||
String path = ARCH->getUserDirectory();
|
||||
String path = DataDirectories::personal();
|
||||
if (!path.empty()) {
|
||||
// complete path
|
||||
path = ARCH->concatPath(path, USR_CONFIG_NAME);
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "net/SocketMultiplexer.h"
|
||||
#include "net/TSocketMultiplexerMethodJob.h"
|
||||
#include "arch/XArch.h"
|
||||
#include "common/DataDirectories.h"
|
||||
|
||||
static const char s_certificateDir[] = { "SSL" };
|
||||
static const char s_certificateFilename[] = { "Barrier.pem" };
|
||||
@ -54,7 +55,7 @@ SecureListenSocket::accept()
|
||||
}
|
||||
|
||||
String certificateFilename = barrier::string::sprintf("%s/%s/%s",
|
||||
ARCH->getProfileDirectory().c_str(),
|
||||
DataDirectories::profile().c_str(),
|
||||
s_certificateDir,
|
||||
s_certificateFilename);
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "mt/Lock.h"
|
||||
#include "arch/XArch.h"
|
||||
#include "base/Log.h"
|
||||
#include "common/DataDirectories.h"
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
@ -699,7 +700,7 @@ SecureSocket::verifyCertFingerprint()
|
||||
String trustedServersFilename;
|
||||
trustedServersFilename = barrier::string::sprintf(
|
||||
"%s/%s/%s",
|
||||
ARCH->getProfileDirectory().c_str(),
|
||||
DataDirectories::profile().c_str(),
|
||||
kFingerprintDirName,
|
||||
kFingerprintTrustedServersFilename);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user