aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Directory.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-17 13:19:54 (GMT)
committerfluxgen <fluxgen>2003-08-17 13:19:54 (GMT)
commit2211428f2d3de7da6e057624e43dc8d13a106a54 (patch)
tree5b26874c761fcab31d0b192c3c7b9f93080e24fc /src/FbTk/Directory.cc
parent856ca4330f8afcf866a642999a74892afdf9467e (diff)
downloadfluxbox-2211428f2d3de7da6e057624e43dc8d13a106a54.zip
fluxbox-2211428f2d3de7da6e057624e43dc8d13a106a54.tar.bz2
added isDirectory and isRegularFile
Diffstat (limited to 'src/FbTk/Directory.cc')
-rw-r--r--src/FbTk/Directory.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/FbTk/Directory.cc b/src/FbTk/Directory.cc
index 8d327dd..5ec5c0c 100644
--- a/src/FbTk/Directory.cc
+++ b/src/FbTk/Directory.cc
@@ -19,10 +19,13 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Directory.cc,v 1.1 2003/05/18 22:06:59 fluxgen Exp $ 22// $Id: Directory.cc,v 1.2 2003/08/17 13:19:54 fluxgen Exp $
23 23
24#include "Directory.hh" 24#include "Directory.hh"
25 25
26#include <sys/stat.h>
27#include <unistd.h>
28
26namespace FbTk { 29namespace FbTk {
27 30
28Directory::Directory(const char *dir):m_dir(0), 31Directory::Directory(const char *dir):m_dir(0),
@@ -83,4 +86,20 @@ bool Directory::open(const char *dir) {
83 return true; 86 return true;
84} 87}
85 88
89bool Directory::isDirectory(const std::string &filename) {
90 struct stat statbuf;
91 if (stat(filename.c_str(), &statbuf) != 0)
92 return false;
93
94 return S_ISDIR(statbuf.st_mode);
95}
96
97bool Directory::isRegularFile(const std::string &filename) {
98 struct stat statbuf;
99 if (stat(filename.c_str(), &statbuf) != 0)
100 return false;
101
102 return S_ISREG(statbuf.st_mode);
103}
104
86}; // end namespace FbTk 105}; // end namespace FbTk