using namespace structures;
using namespace textual;
-//#define DEBUG_DIRECTORY_TREE
+#define DEBUG_DIRECTORY_TREE
// uncomment for noisier version.
#undef LOG
bool directory_tree::reset(const astring &path, const char *pattern)
{
+ FUNCDEF("reset");
_scanned_okay = false;
WHACK(_real_tree);
+// filename temp_path(path);
+// temp_path.canonicalize();
*_path = path;
+//temp_path.raw();
*_pattern = pattern;
_real_tree = new filename_tree;
+LOG(astring("dirtree::reset to path: ") + path);
+
// check that the top-level is healthy.
directory curr(path, "*");
if (!curr.good()) return false;
filename current(check->_dirname);
if (!current.is_normal()) {
//#ifdef DEBUG_DIRECTORY_TREE
- LOG(astring("skipping abnormal dir: ") + current);
+ LOG(astring("skipping abnormal dir: \"") + current + "\"");
//#endif
continue;
}
while (directory_tree::current_dir(*ted, curr)) {
if (!curr.is_normal()) {
//#ifdef DEBUG_DIRECTORY_TREE
- LOG(astring("skipping abnormal dir: ") + curr);
+ LOG(astring("skipping abnormal dir: \"") + curr + "\"");
//#endif
directory_tree::next(*ted);
continue; // scary non-simple file type.
#endif
if (!curr_file.is_normal()) {
//#ifdef DEBUG_DIRECTORY_TREE
- LOG(astring("skipping abnormal file: ") + curr);
+ LOG(astring("skipping abnormal file: \"") + curr + "\"");
//#endif
continue;
}
if (target_start.raw().t()) {
corresponding_name = filename(target_start.raw()
+ filename::default_separator() + corresponding_name.raw());
+/*doesn't help, not right yet. } else {
+ // if they didn't give us a place to start, we start at the top.
+ corresponding_name = filename(target.path()
+ + filename::default_separator() + corresponding_name.raw());
+*/
}
#ifdef DEBUG_DIRECTORY_TREE
LOG(astring("target with start is: ") + corresponding_name);