mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-27 08:05:41 +00:00
Qt: Fix failing to load unicode filenames on command line
This commit is contained in:
parent
64fc560314
commit
ad0d16e243
|
@ -7,6 +7,24 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
static bool ParseCommandLineParameters(QApplication& app, QtHostInterface* host_interface,
|
||||||
|
std::unique_ptr<SystemBootParameters>* boot_params)
|
||||||
|
{
|
||||||
|
const QStringList args(app.arguments());
|
||||||
|
std::vector<std::string> converted_args;
|
||||||
|
std::vector<char*> converted_argv;
|
||||||
|
converted_args.reserve(args.size());
|
||||||
|
converted_argv.reserve(args.size());
|
||||||
|
|
||||||
|
for (const QString& arg : args)
|
||||||
|
converted_args.push_back(arg.toStdString());
|
||||||
|
|
||||||
|
for (std::string& arg : converted_args)
|
||||||
|
converted_argv.push_back(arg.data());
|
||||||
|
|
||||||
|
return host_interface->ParseCommandLineParameters(args.size(), converted_argv.data(), boot_params);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Register any standard types we need elsewhere
|
// Register any standard types we need elsewhere
|
||||||
|
@ -29,7 +47,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
std::unique_ptr<QtHostInterface> host_interface = std::make_unique<QtHostInterface>();
|
std::unique_ptr<QtHostInterface> host_interface = std::make_unique<QtHostInterface>();
|
||||||
std::unique_ptr<SystemBootParameters> boot_params;
|
std::unique_ptr<SystemBootParameters> boot_params;
|
||||||
if (!host_interface->ParseCommandLineParameters(argc, argv, &boot_params))
|
if (!ParseCommandLineParameters(app, host_interface.get(), &boot_params))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
std::unique_ptr<MainWindow> window = std::make_unique<MainWindow>(host_interface.get());
|
std::unique_ptr<MainWindow> window = std::make_unique<MainWindow>(host_interface.get());
|
||||||
|
|
Loading…
Reference in a new issue