Ignore:
Timestamp:
Jun 21, 2010, 4:44:35 PM (11 years ago)
Author:
charles
Message:

(trunk libT) part of rb07's win32 portability patches from ticket #3311

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.c

    r10783 r10814  
    3939
    4040#ifdef WIN32
     41 #include <w32api.h>
     42 #define WINVER WindowsXP /* freeaddrinfo(),getaddrinfo(),getnameinfo() */
    4143 #include <direct.h> /* _getcwd */
    4244 #include <windows.h> /* Sleep */
     
    13911393    struct stat st;
    13921394    off_t bytesLeft;
    1393     off_t buflen;
     1395    const off_t buflen = 1024 * 128; /* 128 KiB buffer */
    13941396
    13951397    /* make sure the old file exists */
     
    14261428    in = tr_open_file_for_scanning( oldpath );
    14271429    out = tr_open_file_for_writing( newpath );
    1428     buflen = stat( newpath, &st ) ? 4096 : st.st_blksize;
    14291430    buf = tr_valloc( buflen );
    14301431    while( bytesLeft > 0 )
     
    14891490    return buf;
    14901491}
     1492
     1493char *
     1494tr_realpath( const char * path, char * resolved_path )
     1495{
     1496#ifdef WIN32
     1497    /* From a message to the Mingw-msys list, Jun 2, 2005 by Mark Junker. */
     1498    if( GetFullPathNameA( path, TR_PATH_MAX, resolved_path, NULL ) == 0 )
     1499        return NULL;
     1500    return resolved_path;
     1501#else
     1502    return realpath( path, resolved_path );
     1503#endif
     1504}
Note: See TracChangeset for help on using the changeset viewer.