summaryrefslogtreecommitdiffstats
path: root/src/extension/fringtools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/extension/fringtools.cpp')
-rw-r--r--src/extension/fringtools.cpp16
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));
}
//==============================================================================