]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Improve C# support on Cygwin.
authorBruno Haible <bruno@clisp.org>
Mon, 7 Oct 2024 18:39:07 +0000 (20:39 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 7 Oct 2024 18:39:07 +0000 (20:39 +0200)
* 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.

autogen.sh
gettext-tools/src/read-csharp.c
gettext-tools/src/read-resources.c
gettext-tools/src/write-resources.c

index 0c99bdb215c82a4edaa62bf9454243626272265c..cdcb53a909adc124d2f1343b74c387347b69b2d9 100755 (executable)
@@ -184,6 +184,7 @@ if ! $skip_gnulib; then
     copy-file
     csharpcomp
     csharpexec
+    cygpath
     error
     error-progname
     execute
index 254ea3ab987026d8fc895b332de30c41145d8d20..6e2d64e1e3ef507ad00171d13bee5fadf44bbb0c 100644 (file)
@@ -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;
 }
index a0f432e796e0e4254c16a4fafb61f5a862cf9ed4..9c6dd3f84fbf48d77a8e72578edb031d5a0346d6 100644 (file)
@@ -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);
 }
index 40aca4ec835b0d38073e6ad78af164a00c5ba8c6..f520c63d4d8da06a45c934ffd5550370f5a610d8 100644 (file)
@@ -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;