Skip to content

Commit d78258d

Browse files
committed
V2024.8.1
1 parent d3fbd23 commit d78258d

File tree

6 files changed

+24
-21
lines changed

6 files changed

+24
-21
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 2024.8.1
4+
### Breaking Changes
5+
None
6+
### New APIs
7+
None
8+
### Fixes
9+
#### System
10+
- Improved `Nickvision::System::Process`'s handling of arguments
11+
312
## 2024.8.0
413
### Breaking Changes
514
#### System

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ endif()
2020
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
2121

2222
#libnick Definition
23-
project ("libnick" LANGUAGES C CXX VERSION 2024.8.0 DESCRIPTION "A cross-platform base for native Nickvision applications.")
23+
project ("libnick" LANGUAGES C CXX VERSION 2024.8.1 DESCRIPTION "A cross-platform base for native Nickvision applications.")
2424
include(CMakePackageConfigHelpers)
2525
include(GNUInstallDirs)
2626
include(CTest)

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = "libnick"
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = "2024.8.0"
51+
PROJECT_NUMBER = "2024.8.1"
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewer a

manual/README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@
66

77
libnick provides Nickvision apps with a common set of cross-platform APIs for managing system and desktop app functionality such as network management, taskbar icons, translations, app updates, and more.
88

9-
## 2024.8.0
9+
## 2024.8.1
1010
### Breaking Changes
11-
#### System
12-
- `Nickvision::System::Process::kill()` will now kill child processes spawned by the respective process
11+
None
1312
### New APIs
1413
None
1514
### Fixes
16-
#### Logging
17-
- Cleaned up the message logged by `Nickvision::Logging::Logger:log()`
1815
#### System
1916
- Improved `Nickvision::System::Process`'s handling of arguments
2017

src/system/environment.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,11 @@ namespace Nickvision::System
131131
{
132132
return "";
133133
}
134+
std::vector<std::string> args{ StringHelpers::splitArgs(command) };
134135
#ifdef _WIN32
135-
Process process{ findDependency("cmd.exe"), { "/C", command } };
136+
args.insert(args.begin(), "/c");
137+
Process process{ findDependency("cmd.exe"), args };
136138
#else
137-
std::vector<std::string> args{ StringHelpers::splitArgs(command) };
138139
std::string cmd{ args[0] };
139140
args.erase(args.begin());
140141
Process process{ cmd, args };

src/system/process.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,31 +47,27 @@ namespace Nickvision::System
4747
throw std::runtime_error("Failed to create pipe.");
4848
}
4949
//Create process arguments
50-
std::string appArgs{ "" };
51-
for(size_t i = 0; i < m_args.size(); i++)
50+
std::wstring appArgs{ L"\"" + m_path.wstring() + L"\"" };
51+
for(const std::string& arg : m_args)
5252
{
53-
const std::string arg{ m_args[i] };
5453
if(arg.find(' ') != std::string::npos && arg[0] != '\"')
5554
{
56-
appArgs += "\"" + arg + "\"";
55+
appArgs += L" \"" + StringHelpers::wstr(arg) + L"\"";
5756
}
5857
else
5958
{
60-
appArgs += arg;
61-
}
62-
if(i != m_args.size() - 1)
63-
{
64-
appArgs += " ";
59+
appArgs += L" " + StringHelpers::wstr(arg);
6560
}
6661
}
67-
STARTUPINFOA si{ 0 };
68-
si.cb = sizeof(STARTUPINFOA);
62+
std::wcout << appArgs << std::endl;
63+
STARTUPINFOW si{ 0 };
64+
si.cb = sizeof(STARTUPINFOW);
6965
si.hStdError = m_write;
7066
si.hStdOutput = m_write;
7167
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
7268
si.wShowWindow = SW_HIDE;
7369
//Create process
74-
if(!CreateProcessA(m_path.string().c_str(), LPSTR(appArgs.c_str()), nullptr, nullptr, TRUE, CREATE_SUSPENDED | CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP, nullptr, nullptr, &si, &m_pi))
70+
if(!CreateProcessW(nullptr, appArgs.data(), nullptr, nullptr, TRUE, CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP, nullptr, nullptr, &si, &m_pi))
7571
{
7672
std::cerr << CodeHelpers::getLastSystemError() << std::endl;
7773
CloseHandle(m_read);

0 commit comments

Comments
 (0)