diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-09-11 14:38:47 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-09-11 14:38:47 +0900 |
commit | 884c8093d63402a1ad0b502244b791e3c6782be3 (patch) | |
tree | a600d4ab0d431a2bdfe4c15b70df43c14fbd8dd0 /debian/mp4v2/mp4v2-2.0.0~dfsg0/libplatform/io/FileSystem_posix.cpp | |
parent | 14e1aa2006796f147f3f4811fb908a6b01e79253 (diff) | |
download | extra-dependencies-884c8093d63402a1ad0b502244b791e3c6782be3.tar.gz extra-dependencies-884c8093d63402a1ad0b502244b791e3c6782be3.zip |
Added debian extra dependency packages.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'debian/mp4v2/mp4v2-2.0.0~dfsg0/libplatform/io/FileSystem_posix.cpp')
-rw-r--r-- | debian/mp4v2/mp4v2-2.0.0~dfsg0/libplatform/io/FileSystem_posix.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/debian/mp4v2/mp4v2-2.0.0~dfsg0/libplatform/io/FileSystem_posix.cpp b/debian/mp4v2/mp4v2-2.0.0~dfsg0/libplatform/io/FileSystem_posix.cpp new file mode 100644 index 00000000..46cf9337 --- /dev/null +++ b/debian/mp4v2/mp4v2-2.0.0~dfsg0/libplatform/io/FileSystem_posix.cpp @@ -0,0 +1,65 @@ +#include "libplatform/impl.h" +#include <sys/stat.h> + +namespace mp4v2 { namespace platform { namespace io { + +/////////////////////////////////////////////////////////////////////////////// + +bool +FileSystem::exists( string path_ ) +{ + struct stat buf; + return stat( path_.c_str(), &buf ) == 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool +FileSystem::isDirectory( string path_ ) +{ + struct stat buf; + if( stat( path_.c_str(), &buf )) + return false; + return S_ISDIR( buf.st_mode ); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool +FileSystem::isFile( string path_ ) +{ + struct stat buf; + if( stat( path_.c_str(), &buf )) + return false; + return S_ISREG( buf.st_mode ); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool +FileSystem::getFileSize( string path_, File::Size& size_ ) +{ + size_ = 0; + struct stat buf; + if( stat( path_.c_str(), &buf )) + return true; + size_ = buf.st_size; + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool +FileSystem::rename( string from, string to ) +{ + return ::rename( from.c_str(), to.c_str() ) != 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +string FileSystem::DIR_SEPARATOR = "/"; +string FileSystem::PATH_SEPARATOR = ":"; + +/////////////////////////////////////////////////////////////////////////////// + +}}} // namespace mp4v2::platform::io |