Changeset 1332


Ignore:
Timestamp:
01/02/25 02:05:32 (3 days ago)
Author:
Maciej Komosinski
Message:

Compatibility of file stat() and utime() with Embarcadero C++Builder compiler

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/virtfile/stdiofile.cpp

    r1328 r1332  
    8888bool StdioFileSystem::Vstat(const char* path, Stat* out)
    8989{
    90 #ifdef _WIN32
     90#if defined(_WIN32) && !defined(__BORLANDC__)
    9191        //under windows, there are a few choices of _statXX structures: 32bit, 64bit, ansi, widechar (and their corresponding _statXX() functions). For the future: ensure utf8 filenames work.
    9292        using stat = struct _stat64i32; //"struct" because there is also a function with the same name
     
    9696#endif
    9797        stat info;
     98#ifdef __BORLANDC__
     99    #define _stat(a,b) stat(a,b) //embarcadero uses "stat" as struct type and "stat()" as function
     100#endif
    98101        if (_stat(path, &info) != 0) return false;
    99102        out->is_file = S_ISREG(info.st_mode);
     
    108111bool StdioFileSystem::Vsettime(const char* path, double timestamp)
    109112{
    110 #ifdef _WIN32
     113#if defined(_WIN32) && !defined(__BORLANDC__)
    111114        //under windows, there are a few choices of _statXX structures: 32bit, 64bit, ansi, widechar (and their corresponding _statXX() functions). For the future: ensure utf8 filenames work.
    112115        using stat = struct _stat64i32; //"struct" because there is also a function with the same name
     
    117120        stat info;
    118121        if (_stat(path, &info) != 0) return false;
     122#ifdef __BORLANDC__ // when including <utime.h> (no "sys/"), compiles OK when using both no-underscore variants, but causes "unresolved external utime()" during linking, hence need to use both underscored variants:
     123    #define utimbuf _utimbuf
     124    #define utime(a,b) _utime(a,b)
     125#endif
    119126        struct utimbuf times;
    120127#if defined IPHONE && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
Note: See TracChangeset for help on using the changeset viewer.