| | @@ -23,12 +23,20 @@ |
| 23 | 23 | #include <unistd.h> |
| 24 | 24 | #include "file.h" |
| 25 | 25 | |
| 26 | 26 | /* |
| 27 | 27 | ** The file status information from the most recent stat() call. |
| 28 | +** |
| 29 | +** Use _stati64 rather than stat on windows, in order to handle files |
| 30 | +** larger than 2GB. |
| 28 | 31 | */ |
| 29 | | -static struct stat fileStat; |
| 32 | +#if defined(_WIN32) && defined(__MSVCRT__) |
| 33 | + static struct _stati64 fileStat; |
| 34 | +# define stat _stati64 |
| 35 | +#else |
| 36 | + static struct stat fileStat; |
| 37 | +#endif |
| 30 | 38 | static int fileStatValid = 0; |
| 31 | 39 | |
| 32 | 40 | /* |
| 33 | 41 | ** Fill in the fileStat variable for the file named zFilename. |
| 34 | 42 | ** If zFilename==0, then use the previous value of fileStat if |
| | @@ -291,21 +299,29 @@ |
| 291 | 299 | blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut))); |
| 292 | 300 | } |
| 293 | 301 | |
| 294 | 302 | /* |
| 295 | 303 | ** COMMAND: test-canonical-name |
| 304 | +** Usage: %fossil test-canonical-name FILENAME... |
| 296 | 305 | ** |
| 297 | 306 | ** Test the operation of the canonical name generator. |
| 307 | +** Also test Fossil's ability to measure attributes of a file. |
| 298 | 308 | */ |
| 299 | 309 | void cmd_test_canonical_name(void){ |
| 300 | 310 | int i; |
| 301 | 311 | Blob x; |
| 302 | 312 | blob_zero(&x); |
| 303 | 313 | for(i=2; i<g.argc; i++){ |
| 304 | | - file_canonical_name(g.argv[i], &x); |
| 314 | + const char *zName = g.argv[i]; |
| 315 | + file_canonical_name(zName, &x); |
| 305 | 316 | printf("%s\n", blob_buffer(&x)); |
| 306 | 317 | blob_reset(&x); |
| 318 | + printf(" file_size = %lld\n", file_size(zName)); |
| 319 | + printf(" file_mtime = %lld\n", file_mtime(zName)); |
| 320 | + printf(" file_isfile = %d\n", file_isfile(zName)); |
| 321 | + printf(" file_isexe = %d\n", file_isexe(zName)); |
| 322 | + printf(" file_isdir = %d\n", file_isdir(zName)); |
| 307 | 323 | } |
| 308 | 324 | } |
| 309 | 325 | |
| 310 | 326 | /* |
| 311 | 327 | ** Return TRUE if the given filename is canonical. |
| 312 | 328 | |