From: Bruno Haible Date: Mon, 7 Oct 2024 18:39:07 +0000 (+0200) Subject: Improve C# support on Cygwin. X-Git-Tag: v0.23~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5ac77f9935203d6d3c0b6d9b4086e3b64b6e6d03;p=thirdparty%2Fgettext.git Improve C# support on Cygwin. * autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add cygpath. * gettext-tools/src/read-csharp.c: Include cygpath.h. (msgdomain_read_csharp): Convert the directory passed to msgunfmt.net.exe from Cygwin to Windows syntax. * gettext-tools/src/read-resources.c: Include cygpath.h. (read_resources_file): Convert the file name passed to msgunfmt.net.exe from Cygwin to Windows syntax. * gettext-tools/src/write-resources.c: Include cygpath.h. (msgdomain_write_csharp_resources): Convert the file name passed to msgfmt.net.exe from Cygwin to Windows syntax. --- diff --git a/autogen.sh b/autogen.sh index 0c99bdb21..cdcb53a90 100755 --- a/autogen.sh +++ b/autogen.sh @@ -184,6 +184,7 @@ if ! $skip_gnulib; then copy-file csharpcomp csharpexec + cygpath error error-progname execute diff --git a/gettext-tools/src/read-csharp.c b/gettext-tools/src/read-csharp.c index 254ea3ab9..6e2d64e1e 100644 --- a/gettext-tools/src/read-csharp.c +++ b/gettext-tools/src/read-csharp.c @@ -38,6 +38,7 @@ #include "xerror-handler.h" #include "xalloc.h" #include "concat-filename.h" +#include "cygpath.h" #include "gettext.h" #define _(str) gettext (str) @@ -94,6 +95,7 @@ msgdomain_list_ty * msgdomain_read_csharp (const char *resource_name, const char *locale_name, const char *directory) { + char *directory_converted; char *culture_name; const char *args[4]; const char *gettextexedir; @@ -106,6 +108,8 @@ msgdomain_read_csharp (const char *resource_name, const char *locale_name, if (resource_name == NULL) resource_name = "Messages"; + directory_converted = cygpath_w (directory); + /* Convert the locale name to a .NET specific culture name. */ culture_name = xstrdup (locale_name); { @@ -136,7 +140,7 @@ msgdomain_read_csharp (const char *resource_name, const char *locale_name, } /* Prepare arguments. */ - args[0] = directory; + args[0] = directory_converted; args[1] = resource_name; args[2] = culture_name; args[3] = NULL; @@ -166,6 +170,7 @@ msgdomain_read_csharp (const char *resource_name, const char *locale_name, free (assembly_path); free (culture_name); + free (directory_converted); return locals.mdlp; } diff --git a/gettext-tools/src/read-resources.c b/gettext-tools/src/read-resources.c index a0f432e79..9c6dd3f84 100644 --- a/gettext-tools/src/read-resources.c +++ b/gettext-tools/src/read-resources.c @@ -38,6 +38,7 @@ #include "xerror-handler.h" #include "message.h" #include "concat-filename.h" +#include "cygpath.h" #include "gettext.h" #define _(str) gettext (str) @@ -94,6 +95,7 @@ execute_and_read_po_output (const char *progname, void read_resources_file (message_list_ty *mlp, const char *filename) { + char *filename_converted; const char *args[2]; const char *gettextexedir; const char *gettextlibdir; @@ -101,8 +103,10 @@ read_resources_file (message_list_ty *mlp, const char *filename) const char *libdirs[1]; struct locals locals; + filename_converted = cygpath_w (filename); + /* Prepare arguments. */ - args[0] = filename; + args[0] = filename_converted; args[1] = NULL; /* Make it possible to override the .exe location. This is @@ -138,4 +142,5 @@ read_resources_file (message_list_ty *mlp, const char *filename) } free (assembly_path); + free (filename_converted); } diff --git a/gettext-tools/src/write-resources.c b/gettext-tools/src/write-resources.c index 40aca4ec8..f520c63d4 100644 --- a/gettext-tools/src/write-resources.c +++ b/gettext-tools/src/write-resources.c @@ -43,6 +43,7 @@ #include "xalloc.h" #include "concat-filename.h" #include "fwriteerror.h" +#include "cygpath.h" #include "gettext.h" #define _(str) gettext (str) @@ -164,6 +165,9 @@ but the C# .resources format doesn't support plural handling\n"))); between builds in the same conditions. */ message_list_delete_header_field (mlp, "POT-Creation-Date:"); + /* On Windows, assume a native Windows implementation of C#. */ + char *file_name_converted = cygpath_w (file_name); + /* Execute the WriteResource program. */ { const char *args[2]; @@ -172,7 +176,7 @@ but the C# .resources format doesn't support plural handling\n"))); struct locals locals; /* Prepare arguments. */ - args[0] = file_name; + args[0] = file_name_converted; args[1] = NULL; /* Make it possible to override the .exe location. This is @@ -195,6 +199,8 @@ but the C# .resources format doesn't support plural handling\n"))); free (assembly_path); } + + free (file_name_converted); } return 0;