summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/common/io.c13
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)
void fat_size(unsigned int* size, unsigned int* free)
{
#ifdef WIN32
- *size = 2049;
- *free = 1037;
+ long secperclus, bytespersec, free_clusters, num_clusters;
+
+ if (GetDiskFreeSpace(NULL, &secperclus, &bytespersec, &free_clusters,
+ &num_clusters)) {
+ if (size)
+ *size = num_clusters * secperclus / 2 * (bytespersec / 512);
+ if (free)
+ *free = free_clusters * secperclus / 2 * (bytespersec / 512);
+ }
#else
struct statfs fs;
@@ -269,13 +276,13 @@ void fat_size(unsigned int* size, unsigned int* free)
if (free)
*free = fs.f_bfree * (fs.f_bsize / 1024);
}
+#endif
else {
if (size)
*size = 0;
if (free)
*free = 0;
}
-#endif
}
int sim_fsync(int fd)