Ignore:
Timestamp:
12/27/14 01:01:43 (9 years ago)
Author:
Maciej Komosinski
Message:

Support for wide char (unicode) names of files and directories under Windows, internally encoded as char* utf-8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/nonstd_stdio.h

    r247 r281  
    2020 #include <dir.h>
    2121#else
    22  #ifndef MOBILE2D
    2322 #include <direct.h>
    24  #endif
    2523 #define mkdir _mkdir
     24 #define S_ISDIR(m)     (((m)&S_IFDIR)==S_IFDIR)
    2625#endif
    2726
    28 #ifndef MOBILE2D
    29  #include <io.h> //borland compiler: include <io.h> before <dir.h> causes the SimWorld class in "simul.h" be unrecognized, for unknown reason :O moreover, this problem is only pertinent to the CLI project, not GUI. Maybe this is caused by global defines like NOVCL, NO_STRICT etc.?
     27#include <io.h> //borland compiler: include <io.h> before <dir.h> causes the SimWorld class in "simul.h" be unrecognized, for unknown reason :O moreover, this problem is only pertinent to the CLI project, not GUI. Maybe this is caused by global defines like NOVCL, NO_STRICT etc.?
    3028// #define makeDirectory(name) mkdir(name)
    31 #endif
    32 
    33  #define S_ISDIR(x) ((x & _S_IFDIR)==_S_IFDIR)
    3429
    3530#else
    3631
    37  #include <unistd.h>
    38  #include <sys/stat.h>
     32#include <unistd.h>
     33#include <sys/stat.h>
    3934// #define makeDirectory(name) mkdir(name,0777)
    40  #define _unlink unlink //_unlink jest ISO-conformant, unlink jest POSIX-deprecated
    41  #define _stat stat
     35#define _unlink unlink //_unlink jest ISO-conformant, unlink jest POSIX-deprecated
     36#define _stat stat
    4237#endif
    4338
     
    4944#ifdef __ANDROID__
    5045#include <nv_file/nv_file.h>
    51  struct rwFILE //jedno z dwoch pol jest zainicjowane w zaleznosci od tego gdzie jest plik
    52  { //nvidia uses a similar trick in nv_file.h (STD_FILE and APK_FILE), maybe doing a similar thing here is redundant? but their trick uses some trial-and-error code (see NvFOpen())
     46struct rwFILE //jedno z dwoch pol jest zainicjowane w zaleznosci od tego gdzie jest plik
     47{ //nvidia uses a similar trick in nv_file.h (STD_FILE and APK_FILE), maybe doing a similar thing here is redundant? but their trick uses some trial-and-error code (see NvFOpen())
    5348        NvFile *rfile; //can only read
    5449        FILE *rwfile;
    5550        rwFILE() {rfile=rwfile=NULL;}
    56  };
    57  typedef rwFILE MFILE;
     51};
     52typedef rwFILE MFILE;
    5853#else //SHP:
    59  //z <stdio.h> wzielismy sprintfy i inne ktore dzia³aj¹...
    60  #include <FIo.h>
    61  // wklejone z sailora w ramach integracji frams+engine
    62  // ale to nie sprawia ze framsy korzystaja z mfile - potrzebna jest implementacja virtfile dla bady! (patrz: stdiofile.h)
    63  // i wtedy bedzie mozna mfile wywalic tez z sailora
    64  typedef Osp::Io::File MFILE;
     54//z <stdio.h> wzielismy sprintfy i inne ktore dzia³aj¹...
     55#include <FIo.h>
     56// wklejone z sailora w ramach integracji frams+engine
     57// ale to nie sprawia ze framsy korzystaja z mfile - potrzebna jest implementacja virtfile dla bady! (patrz: stdiofile.h)
     58// i wtedy bedzie mozna mfile wywalic tez z sailora
     59typedef Osp::Io::File MFILE;
    6560#endif
    6661
     
    8277
    8378#else
    84  typedef FILE MFILE;
     79typedef FILE MFILE;
     80#ifdef _WIN32
     81 #define mfopen _wfopen
     82#else
    8583 #define mfopen fopen
    86  #define mfclose fclose
    87  #define mfread fread
    88  #define mfwrite fwrite
    89  #define mfputs fputs
    90  #define mfgets fgets
    91  #define mfeof feof
    92  #define mfseek fseek
    93  #define mftell ftell
     84#endif
     85#define mfclose fclose
     86#define mfread fread
     87#define mfwrite fwrite
     88#define mfputs fputs
     89#define mfgets fgets
     90#define mfeof feof
     91#define mfseek fseek
     92#define mftell ftell
    9493#endif
    9594
Note: See TracChangeset for help on using the changeset viewer.