diff options
author | fluxgen <fluxgen> | 2004-04-19 18:10:44 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2004-04-19 18:10:44 (GMT) |
commit | 1355708ae228c8348060e2cfaa4ce2e886a1a232 (patch) | |
tree | 7bfcc6350b45f03012b7b135001f568fa32ea3ef /util/fbrun | |
parent | 95c20b15f90ae8b406b2c9a4e6eae4e3e8d0c77f (diff) | |
download | fluxbox-1355708ae228c8348060e2cfaa4ce2e886a1a232.zip fluxbox-1355708ae228c8348060e2cfaa4ce2e886a1a232.tar.bz2 |
using fbtk directory, patch from Mathias Gumz
Diffstat (limited to 'util/fbrun')
-rw-r--r-- | util/fbrun/FbRun.cc | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc index a409527..11beb77 100644 --- a/util/fbrun/FbRun.cc +++ b/util/fbrun/FbRun.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: FbRun.cc,v 1.27 2004/04/18 18:57:24 fluxgen Exp $ | 22 | // $Id: FbRun.cc,v 1.28 2004/04/19 18:10:44 fluxgen Exp $ |
23 | 23 | ||
24 | #include "FbRun.hh" | 24 | #include "FbRun.hh" |
25 | 25 | ||
@@ -27,6 +27,7 @@ | |||
27 | #include "EventManager.hh" | 27 | #include "EventManager.hh" |
28 | #include "Color.hh" | 28 | #include "Color.hh" |
29 | #include "KeyUtil.hh" | 29 | #include "KeyUtil.hh" |
30 | #include "Directory.hh" | ||
30 | 31 | ||
31 | #ifdef HAVE_CONFIG_H | 32 | #ifdef HAVE_CONFIG_H |
32 | #include "config.h" | 33 | #include "config.h" |
@@ -42,11 +43,6 @@ | |||
42 | #include <X11/Xutil.h> | 43 | #include <X11/Xutil.h> |
43 | #include <X11/cursorfont.h> | 44 | #include <X11/cursorfont.h> |
44 | 45 | ||
45 | #include <sys/types.h> | ||
46 | #include <sys/stat.h> | ||
47 | #include <dirent.h> | ||
48 | #include <unistd.h> | ||
49 | |||
50 | #include <iostream> | 46 | #include <iostream> |
51 | #include <iterator> | 47 | #include <iterator> |
52 | #include <fstream> | 48 | #include <fstream> |
@@ -102,34 +98,30 @@ FbRun::FbRun(int x, int y, size_t width): | |||
102 | XSetWMHints(m_display, window(), &wmhints); | 98 | XSetWMHints(m_display, window(), &wmhints); |
103 | } | 99 | } |
104 | 100 | ||
105 | |||
106 | string path= getenv("PATH"); | 101 | string path= getenv("PATH"); |
107 | |||
108 | unsigned int l; | 102 | unsigned int l; |
109 | unsigned int r; | 103 | unsigned int r; |
104 | FbTk::Directory dir; | ||
110 | 105 | ||
111 | for(l= 0, r= 0; r < path.size(); r++) { | 106 | for(l= 0, r= 0; r < path.size(); r++) { |
112 | if (path[r]==':' && r - l > 0) { | 107 | if ((path[r]==':' || r == path.size() - 1) && r - l > 0) { |
113 | struct dirent** namelist; | ||
114 | struct stat buf; | ||
115 | int n; | ||
116 | 108 | ||
117 | string dir= path.substr(l, r - l); | 109 | string filename; |
118 | n= scandir(dir.c_str(), &namelist, 0, alphasort); | 110 | string fncomplete; |
111 | dir.open(path.substr(l, r - l).c_str()); | ||
112 | int n= dir.entries(); | ||
119 | if (n >= 0) { | 113 | if (n >= 0) { |
120 | while(n--) { | 114 | while(n--) { |
121 | if (!stat((dir + "/" + namelist[n]->d_name).c_str(), &buf) | 115 | filename= dir.readFilename(); |
122 | && S_ISREG(buf.st_mode) && | 116 | fncomplete= dir.name() + "/" + filename; |
123 | (buf.st_mode & S_IXUSR | 117 | if (dir.isRegularFile(fncomplete) && |
124 | || buf.st_mode & S_IXGRP | 118 | dir.isExecutable(fncomplete)) { |
125 | || buf.st_mode & S_IXOTH)) { | 119 | m_apps.push_back(filename); |
126 | m_apps.push_back(namelist[n]->d_name); | ||
127 | } | 120 | } |
128 | free(namelist[n]); | ||
129 | } | 121 | } |
130 | free(namelist); | ||
131 | } | 122 | } |
132 | l= r + 1; | 123 | l= r + 1; |
124 | dir.close(); | ||
133 | } | 125 | } |
134 | } | 126 | } |
135 | 127 | ||