aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Directory.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-04-19 18:09:15 (GMT)
committerfluxgen <fluxgen>2004-04-19 18:09:15 (GMT)
commit95c20b15f90ae8b406b2c9a4e6eae4e3e8d0c77f (patch)
tree6756ae07f904d0a82832d08bb500e694eb651c50 /src/FbTk/Directory.cc
parentbb2f1c87136c930f1a91ec8864890a5edb2c04f2 (diff)
downloadfluxbox-95c20b15f90ae8b406b2c9a4e6eae4e3e8d0c77f.zip
fluxbox-95c20b15f90ae8b406b2c9a4e6eae4e3e8d0c77f.tar.bz2
added name and isExecutable, patch from Mathias Gumz
Diffstat (limited to 'src/FbTk/Directory.cc')
-rw-r--r--src/FbTk/Directory.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/FbTk/Directory.cc b/src/FbTk/Directory.cc
index 5ec5c0c..1f2ac7d 100644
--- a/src/FbTk/Directory.cc
+++ b/src/FbTk/Directory.cc
@@ -19,7 +19,7 @@
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.2 2003/08/17 13:19:54 fluxgen Exp $ 22// $Id: Directory.cc,v 1.3 2004/04/19 18:09:15 fluxgen Exp $
23 23
24#include "Directory.hh" 24#include "Directory.hh"
25 25
@@ -60,6 +60,7 @@ std::string Directory::readFilename() {
60void Directory::close() { 60void Directory::close() {
61 if (m_dir != 0) { 61 if (m_dir != 0) {
62 closedir(m_dir); 62 closedir(m_dir);
63 m_name.clear();
63 m_dir = 0; 64 m_dir = 0;
64 m_num_entries = 0; 65 m_num_entries = 0;
65 } 66 }
@@ -77,6 +78,8 @@ bool Directory::open(const char *dir) {
77 if (m_dir == 0) // successfull loading? 78 if (m_dir == 0) // successfull loading?
78 return false; 79 return false;
79 80
81 m_name= dir;
82
80 // get number of entries 83 // get number of entries
81 while (read()) 84 while (read())
82 m_num_entries++; 85 m_num_entries++;
@@ -102,4 +105,14 @@ bool Directory::isRegularFile(const std::string &filename) {
102 return S_ISREG(statbuf.st_mode); 105 return S_ISREG(statbuf.st_mode);
103} 106}
104 107
108bool Directory::isExecutable(const std::string &filename) {
109 struct stat statbuf;
110 if (stat(filename.c_str(), &statbuf) != 0)
111 return false;
112
113 return statbuf.st_mode & S_IXUSR ||
114 statbuf.st_mode & S_IXGRP ||
115 statbuf.st_mode & S_IXOTH;
116}
117
105}; // end namespace FbTk 118}; // end namespace FbTk