Skip to content
Extraits de code Groupes Projets
Valider 066ec301 rédigé par Grigori Goronzy's avatar Grigori Goronzy
Parcourir les fichiers

libaegisub: use statvfs instead of statfs

statvfs is the portable POSIX defined interface and is supported on all
major UNIX platforms.

Originally committed to SVN as r5367.
parent 7db22972
Branches
Étiquettes
Aucune requête de fusion associée trouvée
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <string> #include <string>
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <sys/statvfs.h>
#include <algorithm> #include <algorithm>
#endif // LAGI_PRE #endif // LAGI_PRE
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// Unix C // Unix C
#ifndef _WIN32 #ifndef _WIN32
# include <sys/mount.h> // yep, this exists on MacOS X as well, but not on Windows. # include <sys/statvfs.h>
#endif #endif
// Common C++ // Common C++
......
...@@ -60,7 +60,7 @@ void time_log(timeval &tv) { ...@@ -60,7 +60,7 @@ void time_log(timeval &tv) {
} }
uint64_t freespace(std::string &path, PathType type) { uint64_t freespace(std::string &path, PathType type) {
struct statfs fs; struct statvfs fs;
std::string check(path); std::string check(path);
if (type == TypeFile) if (type == TypeFile)
...@@ -68,7 +68,7 @@ uint64_t freespace(std::string &path, PathType type) { ...@@ -68,7 +68,7 @@ uint64_t freespace(std::string &path, PathType type) {
acs::CheckDirRead(check); acs::CheckDirRead(check);
if ((statfs(check.c_str(), &fs)) == 0) { if ((statvfs(check.c_str(), &fs)) == 0) {
return fs.f_bsize * fs.f_bavail; return fs.f_bsize * fs.f_bavail;
} else { } else {
/// @todo We need a collective set of exceptions for ENOTDIR, EIO etc. /// @todo We need a collective set of exceptions for ENOTDIR, EIO etc.
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter