refactor: remove desktop legacy
This commit is contained in:
@ -154,23 +154,19 @@ macro(configure_bin_names)
|
||||
"deskflow-daemon"
|
||||
CACHE STRING "Filename of the daemon binary")
|
||||
|
||||
set(LEGACY_BINARY_NAME
|
||||
"deskflow-legacy"
|
||||
CACHE STRING "Filename of the legacy binary")
|
||||
|
||||
message(VERBOSE "GUI binary: ${GUI_BINARY_NAME}")
|
||||
message(VERBOSE "Server binary: ${SERVER_BINARY_NAME}")
|
||||
message(VERBOSE "Client binary: ${CLIENT_BINARY_NAME}")
|
||||
message(VERBOSE "Core binary: ${CORE_BINARY_NAME}")
|
||||
message(VERBOSE "Daemon binary: ${DAEMON_BINARY_NAME}")
|
||||
message(VERBOSE "Legacy binary: ${LEGACY_BINARY_NAME}")
|
||||
|
||||
|
||||
add_definitions(-DGUI_BINARY_NAME="${GUI_BINARY_NAME}")
|
||||
add_definitions(-DSERVER_BINARY_NAME="${SERVER_BINARY_NAME}")
|
||||
add_definitions(-DCLIENT_BINARY_NAME="${CLIENT_BINARY_NAME}")
|
||||
add_definitions(-DCORE_BINARY_NAME="${CORE_BINARY_NAME}")
|
||||
add_definitions(-DDAEMON_BINARY_NAME="${DAEMON_BINARY_NAME}")
|
||||
add_definitions(-DLEGACY_BINARY_NAME="${LEGACY_BINARY_NAME}")
|
||||
|
||||
endmacro()
|
||||
|
||||
|
||||
59
res/dist/wix/Include.wxi.in
vendored
59
res/dist/wix/Include.wxi.in
vendored
@ -1,30 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Include>
|
||||
<?define AppId="@DESKFLOW_APP_ID@"?>
|
||||
<?define Name="@DESKFLOW_APP_NAME@"?>
|
||||
<?define Version="@DESKFLOW_VERSION@"?>
|
||||
<?define Author="@DESKFLOW_AUTHOR_NAME@"?>
|
||||
<?define BinDir="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@"?>
|
||||
<?define ProjectResDir="@DESKFLOW_PROJECT_RES_DIR@"?>
|
||||
<?define ResDir="@DESKFLOW_RES_DIR@"?>
|
||||
<?define QtDir="@QT_PATH@"?>
|
||||
<?define QtBinDir="$(var.QtDir)\bin"?>
|
||||
<?if $(var.Platform) = "x64"?>
|
||||
<?define ProgramFilesFolder="ProgramFiles64Folder"?>
|
||||
<?define PlatformSimpleName="64-bit"?>
|
||||
<?define UpgradeGuid="@DESKFLOW_MSI_64_GUID@"?>
|
||||
<?else?>
|
||||
<?define ProgramFilesFolder="ProgramFilesFolder"?>
|
||||
<?define PlatformSimpleName="32-bit"?>
|
||||
<?define UpgradeGuid="@DESKFLOW_MSI_32_GUID@"?>
|
||||
<?endif?>
|
||||
<?define QtPluginsPath="$(var.QtDir)\plugins"?>
|
||||
<?define OpenSslExeDir="@OPENSSL_EXE_DIR@"?>
|
||||
<?define OpenSslDllDir="@OPENSSL_ROOT_DIR@/bin"?>
|
||||
<?define GuiBin="@GUI_BINARY_NAME@.exe"?>
|
||||
<?define ServerBin="@SERVER_BINARY_NAME@.exe"?>
|
||||
<?define ClientBin="@CLIENT_BINARY_NAME@.exe"?>
|
||||
<?define CoreBin="@CORE_BINARY_NAME@.exe"?>
|
||||
<?define DaemonBin="@DAEMON_BINARY_NAME@.exe"?>
|
||||
<?define LegacyBin="@LEGACY_BINARY_NAME@.exe"?>
|
||||
</Include>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Include>
|
||||
<?define AppId="@DESKFLOW_APP_ID@"?>
|
||||
<?define Name="@DESKFLOW_APP_NAME@"?>
|
||||
<?define Version="@DESKFLOW_VERSION@"?>
|
||||
<?define Author="@DESKFLOW_AUTHOR_NAME@"?>
|
||||
<?define BinDir="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@"?>
|
||||
<?define ProjectResDir="@DESKFLOW_PROJECT_RES_DIR@"?>
|
||||
<?define ResDir="@DESKFLOW_RES_DIR@"?>
|
||||
<?define QtDir="@QT_PATH@"?>
|
||||
<?define QtBinDir="$(var.QtDir)\bin"?>
|
||||
<?if $(var.Platform) = "x64"?>
|
||||
<?define ProgramFilesFolder="ProgramFiles64Folder"?>
|
||||
<?define PlatformSimpleName="64-bit"?>
|
||||
<?define UpgradeGuid="@DESKFLOW_MSI_64_GUID@"?>
|
||||
<?else?>
|
||||
<?define ProgramFilesFolder="ProgramFilesFolder"?>
|
||||
<?define PlatformSimpleName="32-bit"?>
|
||||
<?define UpgradeGuid="@DESKFLOW_MSI_32_GUID@"?>
|
||||
<?endif?>
|
||||
<?define QtPluginsPath="$(var.QtDir)\plugins"?>
|
||||
<?define OpenSslExeDir="@OPENSSL_EXE_DIR@"?>
|
||||
<?define OpenSslDllDir="@OPENSSL_ROOT_DIR@/bin"?>
|
||||
<?define GuiBin="@GUI_BINARY_NAME@.exe"?>
|
||||
<?define ServerBin="@SERVER_BINARY_NAME@.exe"?>
|
||||
<?define ClientBin="@CLIENT_BINARY_NAME@.exe"?>
|
||||
<?define CoreBin="@CORE_BINARY_NAME@.exe"?>
|
||||
<?define DaemonBin="@DAEMON_BINARY_NAME@.exe"?>
|
||||
</Include>
|
||||
|
||||
1
res/dist/wix/Product.wxs
vendored
1
res/dist/wix/Product.wxs
vendored
@ -88,7 +88,6 @@
|
||||
<File Source="$(var.BinDir)/$(var.ClientBin)">
|
||||
<fire:FirewallException Id="ClientFirewallException" IgnoreFailure="yes" Name="$(var.Name) Client" Scope="any"/>
|
||||
</File>
|
||||
<File Source="$(var.BinDir)/$(var.LegacyBin)" />
|
||||
<?if $(var.Platform) = x64 ?>
|
||||
<File Source="$(var.OpenSslDllDir)/libssl-3-x64.dll"/>
|
||||
<File Source="$(var.OpenSslDllDir)/libcrypto-3-x64.dll"/>
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
add_subdirectory(deskflowd)
|
||||
|
||||
if(BUILD_UNIFIED)
|
||||
add_subdirectory(deskflow-core)
|
||||
@ -23,4 +22,5 @@ else()
|
||||
add_subdirectory(deskflows)
|
||||
endif(BUILD_UNIFIED)
|
||||
|
||||
add_subdirectory(deskflow-legacy)
|
||||
## Only used on windows
|
||||
add_subdirectory(deskflowd)
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
# Deskflow -- mouse and keyboard sharing utility
|
||||
# Copyright (C) 2024 Chris Rizzitello <sithlord48@gmail.com>
|
||||
# Copyright (C) 2012-2024 Symless Ltd.
|
||||
# Copyright (C) 2009-2012 Nick Bolton
|
||||
#
|
||||
# This package is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# found in the file LICENSE that should have accompanied this file.
|
||||
#
|
||||
# This package is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(target ${LEGACY_BINARY_NAME})
|
||||
|
||||
add_executable(${target} "${target}.cpp")
|
||||
if(WIN32)
|
||||
target_sources(${target} PRIVATE "${PROJECT_BINARY_DIR}/src/version.rc")
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
${target}
|
||||
app
|
||||
arch
|
||||
base
|
||||
client
|
||||
io
|
||||
ipc
|
||||
mt
|
||||
net
|
||||
platform
|
||||
server
|
||||
${libs})
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
install(TARGETS ${target} DESTINATION ${DESKFLOW_BUNDLE_BINARY_DIR})
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
install(TARGETS ${target} DESTINATION bin)
|
||||
endif()
|
||||
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2014-2016 Symless Ltd.
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file LICENSE that should have accompanied this file.
|
||||
*
|
||||
* This package is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "arch/Arch.h"
|
||||
#include "deskflow/ToolApp.h"
|
||||
|
||||
#if SYSAPI_WIN32
|
||||
#include "arch/win32/ArchMiscWindows.h"
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#if SYSAPI_WIN32
|
||||
// record window instance for tray icon, etc
|
||||
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
|
||||
#endif
|
||||
|
||||
ToolApp app;
|
||||
return app.run(argc, argv);
|
||||
}
|
||||
@ -15,9 +15,9 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(target ${DAEMON_BINARY_NAME})
|
||||
# Daemon is only needed on Windows for elevating processes to deal with UAC.
|
||||
if(WIN32)
|
||||
set(target ${DAEMON_BINARY_NAME})
|
||||
add_executable(${target} WIN32
|
||||
deskflowd.cpp
|
||||
"${PROJECT_BINARY_DIR}/src/version.rc"
|
||||
|
||||
@ -23,7 +23,6 @@
|
||||
#include "deskflow/ArgsBase.h"
|
||||
#include "deskflow/ClientArgs.h"
|
||||
#include "deskflow/ServerArgs.h"
|
||||
#include "deskflow/ToolArgs.h"
|
||||
|
||||
#ifdef WINAPI_MSWINDOWS
|
||||
#include <VersionHelpers.h>
|
||||
@ -165,26 +164,6 @@ bool ArgParser::parsePlatformArgs(
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ArgParser::parseToolArgs(ToolArgs &args, int argc, const char *const *argv)
|
||||
{
|
||||
// We support exactly one argument at a fix position
|
||||
static const int only_index{1};
|
||||
if (isArg(only_index, argc, argv, nullptr, "--get-active-desktop", 0)) {
|
||||
args.m_printActiveDesktopName = true;
|
||||
return true;
|
||||
} else if (isArg(only_index, argc, argv, nullptr, "--get-installed-dir", 0)) {
|
||||
args.m_getInstalledDir = true;
|
||||
return true;
|
||||
} else if (isArg(only_index, argc, argv, nullptr, "--get-profile-dir", 0)) {
|
||||
args.m_getProfileDir = true;
|
||||
return true;
|
||||
} else if (isArg(only_index, argc, argv, nullptr, "--get-arch", 0)) {
|
||||
args.m_getArch = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ArgParser::parseGenericArgs(int argc, const char *const *argv, int &i)
|
||||
{
|
||||
if (isArg(i, argc, argv, "-a", "--address", 1)) {
|
||||
|
||||
@ -26,7 +26,6 @@ class ServerArgs;
|
||||
class ClientArgs;
|
||||
} // namespace deskflow
|
||||
|
||||
class ToolArgs;
|
||||
class App;
|
||||
|
||||
class ArgParser
|
||||
@ -38,7 +37,6 @@ public:
|
||||
bool parseServerArgs(deskflow::ServerArgs &args, int argc, const char *const *argv);
|
||||
bool parseClientArgs(deskflow::ClientArgs &args, int argc, const char *const *argv);
|
||||
bool parsePlatformArgs(deskflow::ArgsBase &argsBase, const int &argc, const char *const *argv, int &i, bool isServer);
|
||||
bool parseToolArgs(ToolArgs &args, int argc, const char *const *argv);
|
||||
bool parseGenericArgs(int argc, const char *const *argv, int &i);
|
||||
bool parseDeprecatedArgs(int argc, const char *const *argv, int &i);
|
||||
void setArgsBase(deskflow::ArgsBase &argsBase)
|
||||
|
||||
@ -153,10 +153,6 @@ add_library(${lib_name} STATIC ${PLATFORM_CODE}
|
||||
ServerTaskBarReceiver.h
|
||||
StreamChunker.cpp
|
||||
StreamChunker.h
|
||||
ToolApp.cpp
|
||||
ToolApp.h
|
||||
ToolArgs.cpp
|
||||
ToolArgs.h
|
||||
XDeskflow.cpp
|
||||
XDeskflow.h
|
||||
XScreen.cpp
|
||||
|
||||
@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2014-2016 Symless Ltd.
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file LICENSE that should have accompanied this file.
|
||||
*
|
||||
* This package is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "deskflow/ToolApp.h"
|
||||
|
||||
#include "arch/Arch.h"
|
||||
#include "base/Log.h"
|
||||
#include "base/String.h"
|
||||
#include "deskflow/ArgParser.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if SYSAPI_WIN32
|
||||
#include "platform/MSWindowsSession.h"
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
kErrorOk,
|
||||
kErrorArgs,
|
||||
kErrorException,
|
||||
kErrorUnknown
|
||||
};
|
||||
|
||||
UInt32 ToolApp::run(int argc, char **argv)
|
||||
{
|
||||
if (argc <= 1) {
|
||||
std::cerr << "no args" << std::endl;
|
||||
return kErrorArgs;
|
||||
}
|
||||
|
||||
try {
|
||||
ArgParser argParser(this);
|
||||
bool result = argParser.parseToolArgs(m_args, argc, argv);
|
||||
|
||||
if (!result) {
|
||||
m_bye(kExitArgs);
|
||||
}
|
||||
|
||||
if (m_args.m_printActiveDesktopName) {
|
||||
#if SYSAPI_WIN32
|
||||
MSWindowsSession session;
|
||||
String name = session.getActiveDesktopName();
|
||||
if (name.empty()) {
|
||||
LOG((CLOG_CRIT "failed to get active desktop name"));
|
||||
return kExitFailed;
|
||||
} else {
|
||||
String output = deskflow::string::sprintf("activeDesktop:%s", name.c_str());
|
||||
LOG((CLOG_INFO "%s", output.c_str()));
|
||||
}
|
||||
#endif
|
||||
} else if (m_args.m_getInstalledDir) {
|
||||
std::cout << ARCH->getInstalledDirectory() << std::endl;
|
||||
} else if (m_args.m_getProfileDir) {
|
||||
std::cout << ARCH->getProfileDirectory() << std::endl;
|
||||
} else if (m_args.m_getArch) {
|
||||
std::cout << ARCH->getPlatformName() << std::endl;
|
||||
} else {
|
||||
throw XDeskflow("Nothing to do");
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
LOG((CLOG_CRIT "an error occurred: %s\n", e.what()));
|
||||
return kExitFailed;
|
||||
} catch (...) {
|
||||
LOG((CLOG_CRIT "an unknown error occurred\n"));
|
||||
return kExitFailed;
|
||||
}
|
||||
|
||||
#if WINAPI_XWINDOWS
|
||||
// HACK: avoid sigsegv on linux
|
||||
m_bye(kErrorOk);
|
||||
#endif
|
||||
|
||||
return kErrorOk;
|
||||
}
|
||||
|
||||
void ToolApp::help()
|
||||
{
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2014-2016 Symless Ltd.
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file LICENSE that should have accompanied this file.
|
||||
*
|
||||
* This package is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/basic_types.h"
|
||||
#include "deskflow/App.h"
|
||||
#include "deskflow/ToolArgs.h"
|
||||
|
||||
class ToolApp : public MinimalApp
|
||||
{
|
||||
public:
|
||||
UInt32 run(int argc, char **argv);
|
||||
void help();
|
||||
|
||||
private:
|
||||
ToolArgs m_args;
|
||||
};
|
||||
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2014-2016 Symless Ltd.
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file LICENSE that should have accompanied this file.
|
||||
*
|
||||
* This package is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "deskflow/ToolArgs.h"
|
||||
|
||||
ToolArgs::ToolArgs()
|
||||
: m_printActiveDesktopName(false),
|
||||
m_getInstalledDir(false),
|
||||
m_getProfileDir(false),
|
||||
m_getArch(false)
|
||||
{
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2014-2016 Symless Ltd.
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file LICENSE that should have accompanied this file.
|
||||
*
|
||||
* This package is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base/String.h"
|
||||
|
||||
class ToolArgs
|
||||
{
|
||||
public:
|
||||
ToolArgs();
|
||||
|
||||
public:
|
||||
bool m_printActiveDesktopName;
|
||||
bool m_getInstalledDir;
|
||||
bool m_getProfileDir;
|
||||
bool m_getArch;
|
||||
};
|
||||
@ -48,3 +48,11 @@ target_link_libraries(
|
||||
Qt6::Core
|
||||
Qt6::Widgets
|
||||
Qt6::Network)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(
|
||||
${target}
|
||||
base
|
||||
arch
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -603,38 +603,14 @@ void MSWindowsWatchdog::getActiveDesktop(LPSECURITY_ATTRIBUTES security)
|
||||
{
|
||||
String installedDir = ARCH->getInstalledDirectory();
|
||||
if (!installedDir.empty()) {
|
||||
String deskflowLegacyCommand;
|
||||
deskflowLegacyCommand.append("\"").append(installedDir).append("\\").append(LEGACY_BINARY_NAME).append("\"");
|
||||
deskflowLegacyCommand.append(" --get-active-desktop");
|
||||
|
||||
m_session.updateActiveSession();
|
||||
bool elevateProcess = m_elevateProcess;
|
||||
m_elevateProcess = true;
|
||||
HANDLE userToken = getUserToken(security);
|
||||
m_elevateProcess = elevateProcess;
|
||||
|
||||
BOOL createRet = startProcessAsUser(deskflowLegacyCommand, userToken, security);
|
||||
auto pid = m_processInfo.dwProcessId;
|
||||
if (!createRet) {
|
||||
DWORD rc = GetLastError();
|
||||
RevertToSelf();
|
||||
MSWindowsSession session;
|
||||
String name = session.getActiveDesktopName();
|
||||
if (name.empty()) {
|
||||
LOG((CLOG_CRIT "failed to get active desktop name"));
|
||||
} else {
|
||||
LOG((CLOG_DEBUG "launched %s to check active desktop", LEGACY_BINARY_NAME));
|
||||
String output = deskflow::string::sprintf("activeDesktop:%s", name.c_str());
|
||||
LOG((CLOG_INFO "%s", output.c_str()));
|
||||
}
|
||||
|
||||
ARCH->lockMutex(m_mutex);
|
||||
int waitTime = 0;
|
||||
while (!m_ready) {
|
||||
if (waitTime >= MAXIMUM_WAIT_TIME) {
|
||||
break;
|
||||
}
|
||||
|
||||
ARCH->waitCondVar(m_condVar, m_mutex, 1.0);
|
||||
waitTime++;
|
||||
}
|
||||
m_ready = false;
|
||||
ARCH->unlockMutex(m_mutex);
|
||||
closeProcessHandles(pid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
#include "deskflow/ArgsBase.h"
|
||||
#include "deskflow/ClientArgs.h"
|
||||
#include "deskflow/ServerArgs.h"
|
||||
#include "deskflow/ToolArgs.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@ -211,27 +210,6 @@ TEST(ArgParserTests, assembleCommand_stringArrayWithSpace_returnCommand)
|
||||
EXPECT_EQ("\"stub1 space\" stub2 \"stub3 space\"", command);
|
||||
}
|
||||
|
||||
TEST(ArgParserTests, parseToolArgs_matches_correspondingly)
|
||||
{
|
||||
ArgParser parser(nullptr);
|
||||
std::map<const char *, std::function<bool(ToolArgs const &)>> tests = {
|
||||
{"--get-active-desktop", [](ToolArgs const &a) { return a.m_printActiveDesktopName; }},
|
||||
{"--get-installed-dir", [](ToolArgs const &a) { return a.m_getInstalledDir; }},
|
||||
{"--get-profile-dir", [](ToolArgs const &a) { return a.m_getProfileDir; }},
|
||||
{"--get-arch", [](ToolArgs const &a) { return a.m_getArch; }}
|
||||
};
|
||||
for (auto const &test : tests) {
|
||||
ToolArgs toolArgs;
|
||||
EXPECT_FALSE(test.second(toolArgs));
|
||||
std::array<const char *, 2> twoArgs{LEGACY_BINARY_NAME, test.first};
|
||||
EXPECT_TRUE(parser.parseToolArgs(toolArgs, 2, twoArgs.data()));
|
||||
EXPECT_TRUE(test.second(toolArgs));
|
||||
}
|
||||
ToolArgs toolArgs;
|
||||
std::array<const char *, 2> twoArgs{LEGACY_BINARY_NAME, "--garbage"};
|
||||
EXPECT_FALSE(parser.parseToolArgs(toolArgs, 2, twoArgs.data()));
|
||||
}
|
||||
|
||||
TEST(ArgParserTests, parseServerArgs_parses_each_category)
|
||||
{
|
||||
ArgParser parser(nullptr);
|
||||
|
||||
Reference in New Issue
Block a user