[DEV] add generic get file size

This commit is contained in:
Edouard DUPIN 2016-12-12 21:54:40 +01:00
parent 249c8a4ea3
commit 6cf1b62ceb
2 changed files with 22 additions and 0 deletions

View File

@ -2412,6 +2412,19 @@ std::string etk::theme::getNameDefault(const std::string& _refName) {
* Simple direct wrapper on the FileSystem node access :
*
* -------------------------------------------------------------------------- */
uint64_t etk::FSNodeGetSize(const std::string& _path) {
etk::FSNode tmpNode(_path);
if (false==tmpNode.exist()) {
return 0;
}
return tmpNode.fileSize();
}
#if __CPP_VERSION__ >= 2011
uint64_t etk::FSNodeGetSize(const std::u32string& _path) {
return FSNodeGetSize(etk::to_string(_path));
}
#endif
bool etk::FSNodeRemove(const std::string& _path) {
etk::FSNode tmpNode(_path);
if (false==tmpNode.exist()) {

View File

@ -735,6 +735,15 @@ namespace etk {
std::vector<std::u32string> listU();
#endif
};
/**
* @brief Get the size of a specific file
* @param[in] _path Folder/File/Pipe path of the node
* @return size of the file
*/
uint64_t FSNodeGetSize(const std::string& _path);
#if __CPP_VERSION__ >= 2011
uint64_t FSNodeGetSize(const std::u32string& _path);
#endif
/**
* @brief Simple access for : Remove folder and subFolder, files pipes ...