diff options
author | Frederic Back <fredericback@gmail.com> | 2006-09-25 11:43:38 +0000 |
---|---|---|
committer | Frederic Back <fredericback@gmail.com> | 2006-09-25 11:43:38 +0000 |
commit | 5bcf37b8944759e09fe45c341a555757b53a6e20 (patch) | |
tree | 6fdeb48f24b8f486b47af149bd345e3f00a20048 /src/extension/fringtools.cpp | |
parent | a6d9c932ce4cb91223e46c532489c0f514b09d4f (diff) |
* Corrected several bugs
* Enabled better threading
git-svn-id: file:///home/lennart/svn/public/fring/branches/c_walker@29 d0d2c35f-0a1e-0410-abeb-dabff30a67ee
Diffstat (limited to 'src/extension/fringtools.cpp')
-rw-r--r-- | src/extension/fringtools.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/extension/fringtools.cpp b/src/extension/fringtools.cpp index 9205816..88ec037 100644 --- a/src/extension/fringtools.cpp +++ b/src/extension/fringtools.cpp @@ -29,7 +29,7 @@ Instead of using SumList, the new build_tree will use a tuple */ /// recursive function to build a list system with directory information -PyObject* build_tree( std::string path, const bool& skipHidden) { +PyObject* build_tree( std::string path, const bool& showHidden) { PyObject* l = PyList_New(0); DIR* d = opendir(path.c_str()); if(d == 0) Py_RETURN_NONE; @@ -39,18 +39,16 @@ PyObject* build_tree( std::string path, const bool& skipHidden) { while((e = readdir(d)) != NULL) { std::string fn = e->d_name; - if(skipHidden) if(e->d_name[0] == '.') continue; + + if(!showHidden) if(e->d_name[0] == '.') continue; if(fn == "." || fn == "..") continue; fn = path+"/" +fn; struct stat s; lstat(fn.c_str(), &s); - if (s.st_size < 0) - std::cout << "alert2 " << path << ", " << total << std::endl << std::flush; - if(S_ISDIR(s.st_mode)) { - PyObject* sub = build_tree(fn,skipHidden); + PyObject* sub = build_tree(fn,showHidden); PyTuple_SetItem(sub,0,PyString_FromString(e->d_name)); PyList_Append(l, sub ); total += PyLong_AsUnsignedLong( PyTuple_GET_ITEM(sub,2) ); @@ -67,9 +65,9 @@ PyObject* build_tree( std::string path, const bool& skipHidden) { /// initial function call. static PyObject* fringtools_build_tree(PyObject *self, PyObject *args) { const char *path; - int skip_hidden = 1; - if (!PyArg_ParseTuple(args, "si", &path, &skip_hidden)) return NULL; - return build_tree(std::string(path),(skip_hidden==1)); + int show_hidden = 1; + if (!PyArg_ParseTuple(args, "si", &path, &show_hidden)) return NULL; + return build_tree(std::string(path),(show_hidden==1)); } //============================================================================== |