From 43c2b7e9d7c0bda58cf57bc560e2e921837eccc8 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 6 Feb 2021 12:51:00 +0000 Subject: [PATCH] Bug 797997 - Gnucash File can not be found on Windows from command line. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the path to the Gnucash file is like C:\Temp\Comité\myfile.gnucash on a Windows PC, the file will not be found. This also applies to the log file when --logto C:\Temp\Comité\mylog.txt --- gnucash/gnucash-cli.cpp | 7 ++++++- gnucash/gnucash-core-app.cpp | 10 ---------- gnucash/gnucash.cpp | 7 ++++++- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gnucash/gnucash-cli.cpp b/gnucash/gnucash-cli.cpp index 20f78ff8a3..a679b5af64 100644 --- a/gnucash/gnucash-cli.cpp +++ b/gnucash/gnucash-cli.cpp @@ -38,6 +38,9 @@ extern "C" { #include #include +#ifdef __MINGW32__ +#include +#endif #include namespace bl = boost::locale; @@ -195,7 +198,9 @@ int main(int argc, char **argv) { Gnucash::GnucashCli application (argv[0]); - +#ifdef __MINGW32__ + boost::nowide::args a(argc, argv); // Fix arguments - make them UTF-8 +#endif application.parse_command_line (argc, argv); application.start (argc, argv); diff --git a/gnucash/gnucash-core-app.cpp b/gnucash/gnucash-core-app.cpp index 4559ddf46c..08aecad1f0 100644 --- a/gnucash/gnucash-core-app.cpp +++ b/gnucash/gnucash-core-app.cpp @@ -345,24 +345,14 @@ load_user_config(void) try_load_config_array(stylesheet_files); } - static void gnc_log_init (const std::vector log_flags, const boost::optional &log_to_filename) { if (log_to_filename && !log_to_filename->empty()) { -#ifdef __MINGW64__ - auto *utf8_filename = g_utf16_to_utf8 (log_to_filename->c_str(), -1, NULL, NULL, NULL); -#else auto utf8_filename = log_to_filename->c_str(); -#endif - qof_log_init_filename_special (utf8_filename); - -#ifdef __MINGW64__ - g_free (utf8_filename); -#endif } else { diff --git a/gnucash/gnucash.cpp b/gnucash/gnucash.cpp index b516840993..d7b00ff87a 100644 --- a/gnucash/gnucash.cpp +++ b/gnucash/gnucash.cpp @@ -61,6 +61,9 @@ extern "C" { #include #include +#ifdef __MINGW32__ +#include +#endif #include #include @@ -387,7 +390,9 @@ int main(int argc, char ** argv) { Gnucash::Gnucash application (argv[0]); - +#ifdef __MINGW32__ + boost::nowide::args a(argc, argv); // Fix arguments - make them UTF-8 +#endif /* We need to initialize gtk before looking up all modules */ if(!gtk_init_check (&argc, &argv)) {