Fix launching Syncthing with program/args containing non-ASCII characters
* Pass program/args for Syncthing launcher using UTF-16 under Windows * See https://github.com/Martchus/syncthingtray/issues/107
This commit is contained in:
parent
6aac7b0eae
commit
b828d7c274
|
@ -42,8 +42,10 @@ namespace Data {
|
||||||
#ifdef LIB_SYNCTHING_CONNECTOR_BOOST_PROCESS
|
#ifdef LIB_SYNCTHING_CONNECTOR_BOOST_PROCESS
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
#define LIB_SYNCTHING_CONNECTOR_PLATFORM_ARGS boost::process::windows::create_no_window,
|
#define LIB_SYNCTHING_CONNECTOR_PLATFORM_ARGS boost::process::windows::create_no_window,
|
||||||
|
#define LIB_SYNCTHING_CONNECTOR_STRING_CONVERSION toStdWString
|
||||||
#else
|
#else
|
||||||
#define LIB_SYNCTHING_CONNECTOR_PLATFORM_ARGS
|
#define LIB_SYNCTHING_CONNECTOR_PLATFORM_ARGS
|
||||||
|
#define LIB_SYNCTHING_CONNECTOR_STRING_CONVERSION toLocal8Bit().toStdString
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// \brief Holds data related to the process execution via Boost.Process.
|
/// \brief Holds data related to the process execution via Boost.Process.
|
||||||
|
@ -384,11 +386,11 @@ void SyncthingProcess::start(const QString &program, const QStringList &argument
|
||||||
emit stateChanged(m_process->state = QProcess::Starting);
|
emit stateChanged(m_process->state = QProcess::Starting);
|
||||||
|
|
||||||
// convert args
|
// convert args
|
||||||
auto prog = program.toStdString();
|
auto prog = program.LIB_SYNCTHING_CONNECTOR_STRING_CONVERSION();
|
||||||
auto args = std::vector<std::string>();
|
auto args = std::vector<decltype(arguments.front().LIB_SYNCTHING_CONNECTOR_STRING_CONVERSION())>();
|
||||||
args.reserve(static_cast<std::size_t>(arguments.size()));
|
args.reserve(static_cast<std::size_t>(arguments.size()));
|
||||||
for (const auto &arg : arguments) {
|
for (const auto &arg : arguments) {
|
||||||
args.emplace_back(arg.toStdString());
|
args.emplace_back(arg.LIB_SYNCTHING_CONNECTOR_STRING_CONVERSION());
|
||||||
}
|
}
|
||||||
m_process->program = program;
|
m_process->program = program;
|
||||||
m_process->arguments = arguments;
|
m_process->arguments = arguments;
|
||||||
|
|
Loading…
Reference in New Issue