| ︙ | | | ︙ | |
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
if( isWd && g.allowSymlinks ){
return lstat(zFilename, buf);
}else{
return stat(zFilename, buf);
}
#else
int rc = 0;
wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename);
rc = _wstati64(zMbcs, buf);
fossil_unicode_free(zMbcs);
return rc;
#endif
}
/*
** Fill in the fileStat variable for the file named zFilename.
** If zFilename==0, then use the previous value of fileStat if
|
|
|
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
if( isWd && g.allowSymlinks ){
return lstat(zFilename, buf);
}else{
return stat(zFilename, buf);
}
#else
int rc = 0;
wchar_t *zMbcs = fossil_utf8_to_filename(zFilename);
rc = _wstati64(zMbcs, buf);
fossil_filename_free(zMbcs);
return rc;
#endif
}
/*
** Fill in the fileStat variable for the file named zFilename.
** If zFilename==0, then use the previous value of fileStat if
|
| ︙ | | | ︙ | |
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
/*
** Wrapper around the access() system call.
*/
int file_access(const char *zFilename, int flags){
#ifdef _WIN32
wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename);
int rc = _waccess(zMbcs, flags);
fossil_unicode_free(zMbcs);
#else
int rc = access(zFilename, flags);
#endif
return rc;
}
/*
|
|
|
|
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
/*
** Wrapper around the access() system call.
*/
int file_access(const char *zFilename, int flags){
#ifdef _WIN32
wchar_t *zMbcs = fossil_utf8_to_filename(zFilename);
int rc = _waccess(zMbcs, flags);
fossil_filename_free(zMbcs);
#else
int rc = access(zFilename, flags);
#endif
return rc;
}
/*
|
| ︙ | | | ︙ | |
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
|
struct timeval tv[2];
memset(tv, 0, sizeof(tv[0])*2);
tv[0].tv_sec = newMTime;
tv[1].tv_sec = newMTime;
utimes(zFilename, tv);
#else
struct _utimbuf tb;
wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename);
tb.actime = newMTime;
tb.modtime = newMTime;
_wutime(zMbcs, &tb);
fossil_unicode_free(zMbcs);
#endif
}
/*
** COMMAND: test-set-mtime
**
** Usage: %fossil test-set-mtime FILENAME DATE/TIME
|
|
|
|
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
|
struct timeval tv[2];
memset(tv, 0, sizeof(tv[0])*2);
tv[0].tv_sec = newMTime;
tv[1].tv_sec = newMTime;
utimes(zFilename, tv);
#else
struct _utimbuf tb;
wchar_t *zMbcs = fossil_utf8_to_filename(zFilename);
tb.actime = newMTime;
tb.modtime = newMTime;
_wutime(zMbcs, &tb);
fossil_filename_free(zMbcs);
#endif
}
/*
** COMMAND: test-set-mtime
**
** Usage: %fossil test-set-mtime FILENAME DATE/TIME
|
| ︙ | | | ︙ | |
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
|
}
/*
** Delete a file.
*/
void file_delete(const char *zFilename){
#ifdef _WIN32
wchar_t *z = fossil_utf8_to_unicode(zFilename);
_wunlink(z);
fossil_unicode_free(z);
#else
unlink(zFilename);
#endif
}
/*
** Create the directory named in the argument, if it does not already
|
|
|
|
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
|
}
/*
** Delete a file.
*/
void file_delete(const char *zFilename){
#ifdef _WIN32
wchar_t *z = fossil_utf8_to_filename(zFilename);
_wunlink(z);
fossil_filename_free(z);
#else
unlink(zFilename);
#endif
}
/*
** Create the directory named in the argument, if it does not already
|
| ︙ | | | ︙ | |
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
|
if( rc==2 ){
if( !forceFlag ) return 1;
file_delete(zName);
}
if( rc!=1 ){
#if defined(_WIN32)
int rc;
wchar_t *zMbcs = fossil_utf8_to_unicode(zName);
rc = _wmkdir(zMbcs);
fossil_unicode_free(zMbcs);
return rc;
#else
return mkdir(zName, 0755);
#endif
}
return 0;
}
|
|
|
|
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
|
if( rc==2 ){
if( !forceFlag ) return 1;
file_delete(zName);
}
if( rc!=1 ){
#if defined(_WIN32)
int rc;
wchar_t *zMbcs = fossil_utf8_to_filename(zName);
rc = _wmkdir(zMbcs);
fossil_filename_free(zMbcs);
return rc;
#else
return mkdir(zName, 0755);
#endif
}
return 0;
}
|
| ︙ | | | ︙ | |
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
|
/*
** Like fopen() but always takes a UTF8 argument.
*/
FILE *fossil_fopen(const char *zName, const char *zMode){
#ifdef _WIN32
wchar_t *uMode = fossil_utf8_to_unicode(zMode);
wchar_t *uName = fossil_utf8_to_unicode(zName);
FILE *f = _wfopen(uName, uMode);
fossil_unicode_free(uName);
fossil_unicode_free(uMode);
#else
FILE *f = fopen(zName, zMode);
#endif
return f;
}
|
|
|
|
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
|
/*
** Like fopen() but always takes a UTF8 argument.
*/
FILE *fossil_fopen(const char *zName, const char *zMode){
#ifdef _WIN32
wchar_t *uMode = fossil_utf8_to_unicode(zMode);
wchar_t *uName = fossil_utf8_to_filename(zName);
FILE *f = _wfopen(uName, uMode);
fossil_filename_free(uName);
fossil_unicode_free(uMode);
#else
FILE *f = fopen(zName, zMode);
#endif
return f;
}
|