fix Entry::read_tree() and get_next_path_component()

svn path=/branches/lean-explorer/; revision=9104
This commit is contained in:
Martin Fuchs
2004-04-12 15:55:36 +00:00
parent 61f0b4504d
commit 6936b33b44
6 changed files with 26 additions and 28 deletions
@@ -119,17 +119,17 @@ Entry* Entry::read_tree(const void* path, SORT_ORDER sortOrder)
HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));
Entry* entry = this;
Entry* next_entry = entry;
for(const void*p=path; p&&next_entry; p=entry->get_next_path_component(p)) {
entry = next_entry;
for(const void*p=path; p && entry; ) {
entry->read_directory(sortOrder);
if (entry->_down)
entry->_expanded = true;
next_entry = entry->find_entry(p);
Entry* next_entry = entry->find_entry(p);
p = entry->get_next_path_component(p);
entry = next_entry;
}
SetCursor(old_cursor);
@@ -473,20 +473,3 @@ void Entry::free_subentries()
} while(next);
}
}
const void* Directory::get_next_path_component(const void* p)
{
LPCTSTR s = (LPCTSTR) p;
while(*s && *s!=TEXT('\\') && *s!=TEXT('/'))
++s;
while(*s==TEXT('\\') || *s==TEXT('/'))
++s;
if (!*s)
return NULL;
return s;
}
@@ -99,7 +99,7 @@ public:
void extract_icon();
virtual void read_directory(int scan_flags=SCAN_ALL) {}
virtual const void* get_next_path_component(const void*) {return NULL;}
virtual const void* get_next_path_component(const void*) const {return NULL;}
virtual Entry* find_entry(const void*) {return NULL;}
virtual bool get_path(PTSTR path) const = 0;
virtual ShellPath create_absolute_pidl() const {return (LPCITEMIDLIST)NULL;}
@@ -114,9 +114,6 @@ protected:
Directory() : _path(NULL) {}
virtual ~Directory() {}
// default implementation like that of Windows file systems
virtual const void* get_next_path_component(const void*);
void* _path;
};
@@ -428,7 +428,7 @@ void ShellDirectory::read_directory(int scan_flags)
_scanned = true;
}
const void* ShellDirectory::get_next_path_component(const void* p)
const void* ShellDirectory::get_next_path_component(const void* p) const
{
LPITEMIDLIST pidl = (LPITEMIDLIST)p;
@@ -99,7 +99,7 @@ struct ShellDirectory : public ShellEntry, public Directory
}
virtual void read_directory(int scan_flags=SCAN_ALL);
virtual const void* get_next_path_component(const void*);
virtual const void* get_next_path_component(const void*) const;
virtual Entry* find_entry(const void* p);
virtual bool get_path(PTSTR path) const;
@@ -100,6 +100,23 @@ void WinDirectory::read_directory(int scan_flags)
}
const void* WinDirectory::get_next_path_component(const void* p) const
{
LPCTSTR s = (LPCTSTR) p;
while(*s && *s!=TEXT('\\') && *s!=TEXT('/'))
++s;
while(*s==TEXT('\\') || *s==TEXT('/'))
++s;
if (!*s)
return NULL;
return s;
}
Entry* WinDirectory::find_entry(const void* p)
{
LPCTSTR name = (LPCTSTR)p;
@@ -61,5 +61,6 @@ struct WinDirectory : public WinEntry, public Directory
}
virtual void read_directory(int scan_flags=SCAN_ALL);
virtual const void* get_next_path_component(const void* p) const;
virtual Entry* find_entry(const void*);
};