Skip to content

Commit

Permalink
Merge pull request #969 from albertony/profile_dir
Browse files Browse the repository at this point in the history
Improvements to custom profile dir option
  • Loading branch information
p12tic authored Dec 9, 2020
2 parents ce31584 + 87c5f87 commit 2da6cb3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/lib/barrier/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ class MinimalApp : public App {
" -l --log <file> write log messages to file.\n" \
" --no-tray disable the system tray icon.\n" \
" --enable-drag-drop enable file drag & drop.\n" \
" --enable-crypto enable the crypto (ssl) plugin.\n"

" --enable-crypto enable the crypto (ssl) plugin.\n" \
" --profile-dir <path> use named profile directory instead.\n"
#define HELP_COMMON_INFO_2 \
" -h, --help display this help and exit.\n" \
" --version display version information and exit.\n"
Expand Down
8 changes: 7 additions & 1 deletion src/lib/barrier/ServerApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ ServerApp::help()
# define WINAPI_INFO ""
#endif

// refer to custom profile directory even if not saved yet
String profilePath = argsBase().m_profileDirectory;
if (profilePath.empty()) {
profilePath = DataDirectories::profile();
}

std::ostringstream buffer;
buffer << "Start the barrier server component." << std::endl
<< std::endl
Expand All @@ -150,7 +156,7 @@ ServerApp::help()
<< std::endl
<< "If no configuration file pathname is provided then the first of the" << std::endl
<< "following to load successfully sets the configuration:" << std::endl
<< " " << PathUtilities::concat(DataDirectories::profile(), USR_CONFIG_NAME) << std::endl
<< " " << PathUtilities::concat(profilePath, USR_CONFIG_NAME) << std::endl
<< " " << PathUtilities::concat(DataDirectories::systemconfig(), SYS_CONFIG_NAME) << std::endl;

LOG((CLOG_PRINT "%s", buffer.str().c_str()));
Expand Down
10 changes: 5 additions & 5 deletions src/lib/platform/MSWindowsHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ static BYTE g_deadKeyState[256] = { 0 };
static BYTE g_keyState[256] = { 0 };
static bool g_fakeServerInput = false;
static std::vector<DWORD> g_immuneKeys;

static const std::string ImmuneKeysPath = DataDirectories::profile() + "\\ImmuneKeys.txt";
static std::string g_immuneKeysPath;

static std::vector<DWORD> immune_keys_list()
{
std::vector<DWORD> keys;
std::string badLine;
if (!ImmuneKeysReader::get_list(ImmuneKeysPath.c_str(), keys, badLine))
if (!ImmuneKeysReader::get_list(g_immuneKeysPath.c_str(), keys, badLine))
LOG((CLOG_ERR "Reading immune keys stopped at: %s", badLine.c_str()));
return keys;
}
Expand Down Expand Up @@ -575,8 +574,9 @@ MSWindowsHook::install()
g_fakeServerInput = false;

// setup immune keys
g_immuneKeysPath = DataDirectories::profile() + "\\ImmuneKeys.txt";
g_immuneKeys = immune_keys_list();
LOG((CLOG_DEBUG "Found %u immune keys in %s", g_immuneKeys.size(), ImmuneKeysPath.c_str()));
LOG((CLOG_DEBUG "Found %u immune keys in %s", g_immuneKeys.size(), g_immuneKeysPath.c_str()));

#if NO_GRAB_KEYBOARD
// we only need the mouse hook
Expand Down Expand Up @@ -638,4 +638,4 @@ void
MSWindowsHook::uninstallScreenSaver()
{
g_hkMessage.unset();
}
}

0 comments on commit 2da6cb3

Please sign in to comment.