From ae8fd89b62ce6be017730bc33aff15e1b314c7b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 4 Jan 2018 13:03:41 -0800 Subject: [PATCH] filepath: Added clear and isEmpty methods. --- include/bx/filepath.h | 6 ++++++ src/filepath.cpp | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/bx/filepath.h b/include/bx/filepath.h index 6f80bf6..f4ce83b 100644 --- a/include/bx/filepath.h +++ b/include/bx/filepath.h @@ -56,6 +56,9 @@ namespace bx /// FilePath& operator=(const StringView& _rhs); + /// + void clear(); + /// void set(Dir::Enum _dir); @@ -87,6 +90,9 @@ namespace bx /// bool isAbsolute() const; + /// + bool isEmpty() const; + private: char m_filePath[kMaxFilePath]; }; diff --git a/src/filepath.cpp b/src/filepath.cpp index a9a4395..f3d6a57 100644 --- a/src/filepath.cpp +++ b/src/filepath.cpp @@ -275,6 +275,14 @@ namespace bx return *this; } + void FilePath::clear() + { + if (!isEmpty() ) + { + set(""); + } + } + void FilePath::set(Dir::Enum _dir) { char tmp[kMaxFilePath]; @@ -384,6 +392,11 @@ namespace bx ; } + bool FilePath::isEmpty() const + { + return 0 == strCmp(m_filePath, "."); + } + bool make(const FilePath& _filePath, Error* _err) { BX_ERROR_SCOPE(_err);