diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2017-11-10 12:56:00 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2017-11-10 12:56:00 +0000 |
| commit | 4a088d28f5607ee2713069de71b497eef335e9fd (patch) | |
| tree | afb49c2d5c08e5b1ed1c4046be237e0b031f1cdb /FL | |
| parent | ff1e508e5d3462c2da910fedfa442b0f2b9b3617 (diff) | |
Add missing platform wrapper fl_chdir() for chdir().
Tested under Windows and Linux, but not yet used in library code.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12549 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_System_Driver.H | 9 | ||||
| -rw-r--r-- | FL/fl_utf8.h | 11 |
2 files changed, 12 insertions, 8 deletions
diff --git a/FL/Fl_System_Driver.H b/FL/Fl_System_Driver.H index e49306a96..5bcd8e994 100644 --- a/FL/Fl_System_Driver.H +++ b/FL/Fl_System_Driver.H @@ -63,7 +63,7 @@ public: static const int fl_YValue; static const int fl_XNegative; static const int fl_YNegative; - + // implement if the system adds unwanted program argument(s) virtual int single_arg(const char *arg) { return 0; } // implement if the system adds unwanted program argument pair(s) @@ -81,7 +81,7 @@ public: static void fatal(const char* format, ...); // implement to set the default effect of Fl::error() virtual void fatal(const char* format, va_list args); - + // implement these to support cross-platform file operations virtual char *utf2mbcs(const char *s) {return (char*)s;} virtual char *getenv(const char* v) {return NULL;} @@ -100,12 +100,13 @@ public: virtual int access(const char* f, int mode) { return -1;} virtual int stat(const char* f, struct stat *b) { return -1;} virtual char *getcwd(char* b, int l) {return NULL;} + virtual int chdir(const char* path) {return -1;} virtual int unlink(const char* fname) {return -1;} virtual int mkdir(const char* f, int mode) {return -1;} virtual int rmdir(const char* f) {return -1;} virtual int rename(const char* f, const char *n) {return -1;} - - // the default implementation of these utf8... functions should be enough + + // 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); virtual int utf8locale() {return 1;} diff --git a/FL/fl_utf8.h b/FL/fl_utf8.h index 68ebf3f05..f855f977f 100644 --- a/FL/fl_utf8.h +++ b/FL/fl_utf8.h @@ -160,10 +160,13 @@ FL_EXPORT int fl_chmod(const char* f, int mode); FL_EXPORT int fl_access(const char* f, int mode); /* OD: Portable UTF-8 aware stat wrapper */ -FL_EXPORT int fl_stat( const char *path, struct stat *buffer ); +FL_EXPORT int fl_stat(const char *path, struct stat *buffer); /* OD: Portable UTF-8 aware getcwd wrapper */ -FL_EXPORT char* fl_getcwd( char *buf, int maxlen); +FL_EXPORT char *fl_getcwd(char *buf, int len); + +/* Portable UTF-8 aware chdir wrapper */ +FL_EXPORT int fl_chdir(const char *path); /* OD: Portable UTF-8 aware fopen wrapper */ FL_EXPORT FILE *fl_fopen(const char *f, const char *mode); @@ -175,9 +178,9 @@ FL_EXPORT int fl_system(const char* f); FL_EXPORT int fl_execvp(const char *file, char *const *argv); /* OD: Portable UTF-8 aware open wrapper */ -FL_EXPORT int fl_open(const char* f, int o, ...); +FL_EXPORT int fl_open(const char *fname, int oflags, ...); -FL_EXPORT int fl_open_ext(const char* fname, int binary, int oflags, ...); +FL_EXPORT int fl_open_ext(const char *fname, int binary, int oflags, ...); /* OD: Portable UTF-8 aware unlink wrapper */ FL_EXPORT int fl_unlink(const char *fname); |
