diff options
Diffstat (limited to 'uisimulator/common/io.c')
-rw-r--r-- | uisimulator/common/io.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index 53e2022062..8f72d4f94d 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c | |||
@@ -251,11 +251,16 @@ long sim_lseek(int fildes, long offset, int whence) | |||
251 | 251 | ||
252 | long sim_filesize(int fd) | 252 | long sim_filesize(int fd) |
253 | { | 253 | { |
254 | long old = lseek(fd, 0, SEEK_CUR); | 254 | #ifdef WIN32 |
255 | long size = lseek(fd, 0, SEEK_END); | 255 | return _filelength(fd); |
256 | lseek(fd, old, SEEK_SET); | 256 | #else |
257 | 257 | struct stat buf; | |
258 | return size; | 258 | |
259 | if (!fstat(fd, &buf)) | ||
260 | return buf.st_size; | ||
261 | else | ||
262 | return -1; | ||
263 | #endif | ||
259 | } | 264 | } |
260 | 265 | ||
261 | void fat_size(unsigned int* size, unsigned int* free) | 266 | void fat_size(unsigned int* size, unsigned int* free) |