298 } |
298 } |
299 |
299 |
300 return NULL; |
300 return NULL; |
301 } |
301 } |
302 |
302 |
303 // Get descriptive texts. |
303 /** |
304 // Returns a path as well as a |
304 * Get descriptive texts. Returns the path and free space |
305 // string describing the path. |
305 * left on the device |
306 StringID FiosGetDescText(const char **path) |
306 * @param path string describing the path |
307 { |
307 * @param tfs total free space in megabytes, optional (can be NULL) |
|
308 * @return StringID describing the path (free space or failure) |
|
309 */ |
|
310 StringID FiosGetDescText(const char **path, uint32 *tot) |
|
311 { |
|
312 uint32 free = 0; |
308 *path = _fios_path[0] != '\0' ? _fios_path : "/"; |
313 *path = _fios_path[0] != '\0' ? _fios_path : "/"; |
309 |
314 |
310 #if defined(__linux__) |
315 #if defined(__linux__) |
311 { |
316 { |
312 struct statvfs s; |
317 struct statvfs s; |
313 |
318 |
314 if (statvfs(*path, &s) == 0) { |
319 if (statvfs(*path, &s) != 0) { |
315 uint64 tot = (uint64)s.f_bsize * s.f_bavail; |
320 free = ((uint64)s.f_bsize * s.f_bavail) >> 20; |
316 SetDParam(0, (uint32)(tot >> 20)); |
|
317 return STR_4005_BYTES_FREE; |
|
318 } else |
321 } else |
319 return STR_4006_UNABLE_TO_READ_DRIVE; |
322 return STR_4006_UNABLE_TO_READ_DRIVE; |
320 } |
323 } |
321 #else |
324 #endif |
322 SetDParam(0, 0); |
325 if (tot != NULL) *tot = free; |
323 return STR_4005_BYTES_FREE; |
326 return STR_4005_BYTES_FREE; |
324 #endif |
|
325 } |
327 } |
326 |
328 |
327 void FiosMakeSavegameName(char *buf, const char *name) |
329 void FiosMakeSavegameName(char *buf, const char *name) |
328 { |
330 { |
329 const char* extension; |
331 const char* extension; |