summaryrefslogtreecommitdiff
path: root/src/Fl_System_Driver.H
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2023-11-20 20:12:02 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2023-11-29 16:29:54 +0100
commit727bd94560ca9056cdbe40fe2e7923ed008b6eac (patch)
treef0d202b6c72415751445bfd91f29dd96fe3f59d2 /src/Fl_System_Driver.H
parenta0e4a3fd5d028694e9fa74d2de55eb4f3c3f14b0 (diff)
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).
Diffstat (limited to 'src/Fl_System_Driver.H')
-rw-r--r--src/Fl_System_Driver.H10
1 files changed, 7 insertions, 3 deletions
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