From: Chris Koeritz Date: Tue, 26 Jun 2012 16:32:26 +0000 (-0400) Subject: turned off debugging, appears behavior for abnormal files is fixed. X-Git-Tag: 2.140.90~1303 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=e077c4de15dac0c54a37cef7ccb376e582c09ac8;p=feisty_meow.git turned off debugging, appears behavior for abnormal files is fixed. --- diff --git a/nucleus/library/filesystem/directory.cpp b/nucleus/library/filesystem/directory.cpp index 1460d05c..8e778952 100644 --- a/nucleus/library/filesystem/directory.cpp +++ b/nucleus/library/filesystem/directory.cpp @@ -47,6 +47,9 @@ #endif */ +//#define DEBUG_DIRECTORY + // uncomment for noisier runs. + #undef LOG #define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s) @@ -161,20 +164,16 @@ bool directory::rescan() if (!strcmp(filename_transcoded.s(), par_dir.s())) continue; #ifdef UNICODE -/*temp - to_unicode_persist(fudgemart, filename_transcoded); - if (memcmp((wchar_t*)fudgemart, wfd.cFileName, wcslen(wfd.cFileName)*2)) + #ifdef DEBUG_DIRECTORY + to_unicode_persist(kludgemart, filename_transcoded); + if (memcmp((wchar_t*)kludgemart, wfd.cFileName, wcslen(wfd.cFileName)*2)) printf("failed to compare the string before and after transcoding\n"); -*/ + #endif #endif //wprintf(to_unicode_temp("file is %ls\n"), (wchar_t*)to_unicode_temp(filename_transcoded)); filename temp_name(*_path, filename_transcoded.s()); - if (!temp_name.is_normal()) { - LOG(astring("skipping abnormal file: ") + temp_name); - continue; // cannot be adding goofy named pipes etc; cannot manage those. - } // add this to the appropriate list. if (temp_name.is_directory()) { @@ -183,13 +182,13 @@ bool directory::rescan() _files->concatenate(filename_transcoded); #ifdef UNICODE -/*temp - to_unicode_persist(fudgemart2, temp_name.raw()); - FILE *fpjunk = _wfopen(fudgemart2, to_unicode_temp("rb")); + #ifdef DEBUG_DIRECTORY + to_unicode_persist(kludgemart2, temp_name.raw()); + FILE *fpjunk = _wfopen(kludgemart2, to_unicode_temp("rb")); if (!fpjunk) LOG(astring("failed to open the file for testing: ") + temp_name.raw() + "\n"); if (fpjunk) fclose(fpjunk); -*/ + #endif #endif } @@ -209,6 +208,13 @@ bool directory::rescan() // make sure that the filename matches the pattern also. if (add_it && !fnmatch(_pattern->s(), file, 0)) { filename temp_name(*_path, file); + if (!temp_name.is_normal()) { +#ifdef DEBUG_DIRECTORY + LOG(astring("skipping abnormal file: ") + temp_name); +#endif + entry = readdir(dir); + continue; // cannot be adding goofy named pipes etc; cannot manage those. + } // add this to the appropriate list. if (temp_name.is_directory()) _folders->concatenate(file); diff --git a/nucleus/library/filesystem/directory_tree.cpp b/nucleus/library/filesystem/directory_tree.cpp index 2be520f3..dc78832f 100644 --- a/nucleus/library/filesystem/directory_tree.cpp +++ b/nucleus/library/filesystem/directory_tree.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -28,16 +29,17 @@ #include using namespace basis; -using namespace structures; +using namespace loggers; using namespace nodes; +using namespace structures; using namespace textual; -#define DEBUG_DIRECTORY_TREE +//#define DEBUG_DIRECTORY_TREE // uncomment for noisier version. #undef LOG -#define LOG(to_print) printf("%s::%s: %s\n", static_class_name(), func, astring(to_print).s()) -//CLASS_EMERGENCY_LOG(program_wide_logger::get(), s) +#define LOG(to_print) CLASS_EMERGENCY_LOG(program_wide_logger::get(), to_print) +//printf("%s::%s: %s\n", static_class_name(), func, astring(to_print).s()) ////////////// @@ -434,6 +436,12 @@ filename_tree *directory_tree::seek(const astring &dir_name_in, for (posn = 0; posn < examining.length(); posn++) { check = examining[posn]; filename current(check->_dirname); + if (!current.is_normal()) { +//#ifdef DEBUG_DIRECTORY_TREE + LOG(astring("skipping abnormal dir: ") + current); +//#endif + continue; + } #ifdef DEBUG_DIRECTORY_TREE LOG(astring("looking at ") + current.raw()); #endif @@ -805,8 +813,8 @@ outcome directory_tree::add_path(const astring &new_item, bool just_size) int file_subtract = 0; // if it's a file, then we remove last component. if (!adding.is_directory()) file_subtract = 1; #ifdef DEBUG_DIRECTORY_TREE - if (file_subtract) LOG(astring("adding a file ") + new_item); - else LOG(astring("adding a directory ") + new_item); + if (file_subtract) { LOG(astring("adding a file ") + new_item); } + else { LOG(astring("adding a directory ") + new_item); } #endif // find the common root, break up the path into pieces, and tell us where