diff options
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/common/io.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index 33f1091314..f735c23a70 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c | |||
@@ -256,8 +256,15 @@ off_t sim_filesize(int fd) | |||
256 | void fat_size(unsigned int* size, unsigned int* free) | 256 | void fat_size(unsigned int* size, unsigned int* free) |
257 | { | 257 | { |
258 | #ifdef WIN32 | 258 | #ifdef WIN32 |
259 | *size = 2049; | 259 | long secperclus, bytespersec, free_clusters, num_clusters; |
260 | *free = 1037; | 260 | |
261 | if (GetDiskFreeSpace(NULL, &secperclus, &bytespersec, &free_clusters, | ||
262 | &num_clusters)) { | ||
263 | if (size) | ||
264 | *size = num_clusters * secperclus / 2 * (bytespersec / 512); | ||
265 | if (free) | ||
266 | *free = free_clusters * secperclus / 2 * (bytespersec / 512); | ||
267 | } | ||
261 | #else | 268 | #else |
262 | struct statfs fs; | 269 | struct statfs fs; |
263 | 270 | ||
@@ -269,13 +276,13 @@ void fat_size(unsigned int* size, unsigned int* free) | |||
269 | if (free) | 276 | if (free) |
270 | *free = fs.f_bfree * (fs.f_bsize / 1024); | 277 | *free = fs.f_bfree * (fs.f_bsize / 1024); |
271 | } | 278 | } |
279 | #endif | ||
272 | else { | 280 | else { |
273 | if (size) | 281 | if (size) |
274 | *size = 0; | 282 | *size = 0; |
275 | if (free) | 283 | if (free) |
276 | *free = 0; | 284 | *free = 0; |
277 | } | 285 | } |
278 | #endif | ||
279 | } | 286 | } |
280 | 287 | ||
281 | int sim_fsync(int fd) | 288 | int sim_fsync(int fd) |