X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Ffilesystem%2Fdirectory.cpp;h=8e7789521e434281fb47837dcea7477efc403d1e;hb=51d71c226be424b6a698c7474d237e8c69661af5;hp=e4e3adcdb92ed7bef3e23995145ddcc7d4cffd63;hpb=457b128b77b5b4a0b7dd3094de543de2ce1477ad;p=feisty_meow.git diff --git a/nucleus/library/filesystem/directory.cpp b/nucleus/library/filesystem/directory.cpp index e4e3adcd..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,10 +164,11 @@ 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)); @@ -178,11 +182,13 @@ bool directory::rescan() _files->concatenate(filename_transcoded); #ifdef UNICODE - 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 } @@ -202,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); @@ -243,7 +256,7 @@ bool directory::remove_directory(const astring &path) bool directory::recursive_create(const astring &directory_name) { -// FUNCDEF("recursive_create"); + FUNCDEF("recursive_create"); filename dir(directory_name); string_array pieces; dir.separate(pieces);