From 727bd94560ca9056cdbe40fe2e7923ed008b6eac Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Mon, 20 Nov 2023 20:12:02 +0100 Subject: Add commandline conversion for Windows (no-op on other platforms) - add Fl::args_to_utf8() to convert commandline arguments to UTF-8 This new function closes the gap that previously only Visual Studio applications converted their commandlines to UTF-8. Tested with MinGW, MSYS2/MinGW-w64, and Visual Studio (2019). --- src/Fl_System_Driver.H | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/Fl_System_Driver.H') diff --git a/src/Fl_System_Driver.H b/src/Fl_System_Driver.H index e7230f74e..3dad3d754 100644 --- a/src/Fl_System_Driver.H +++ b/src/Fl_System_Driver.H @@ -110,6 +110,10 @@ public: virtual int rmdir(const char*) {return -1;} virtual int rename(const char* /*f*/, const char * /*n*/) {return -1;} + // Windows commandline argument conversion to UTF-8. + // Default implementation: no-op, overridden only on Windows + virtual int args_to_utf8(int argc, char ** &argv) { return argc; } + // the default implementation of these utf8... functions should be enough virtual unsigned utf8towc(const char* src, unsigned srclen, wchar_t* dst, unsigned dstlen); virtual unsigned utf8fromwc(char* dst, unsigned dstlen, const wchar_t* src, unsigned srclen); @@ -124,9 +128,9 @@ public: virtual int filename_list(const char * /*d*/, dirent ***, int (* /*sort*/)(struct dirent **, struct dirent **), char *errmsg=NULL, int errmsg_sz=0) { - (void)errmsg; (void)errmsg_sz; - return -1; - } + (void)errmsg; (void)errmsg_sz; + return -1; + } // the default implementation of filename_expand() may be enough virtual int filename_expand(char *to, int tolen, const char *from); // to implement -- cgit v1.2.3