mirror of
https://github.com/ksherlock/mpw.git
synced 2024-11-22 00:32:44 +00:00
root directory is 2, not 1.
This commit is contained in:
parent
cc477e0865
commit
6c8511838e
@ -5,6 +5,8 @@
|
||||
|
||||
namespace OS {
|
||||
|
||||
const int RootPathID = 2;
|
||||
|
||||
std::deque<FSSpecManager::Entry> FSSpecManager::_pathQueue;
|
||||
|
||||
void FSSpecManager::Init()
|
||||
@ -49,7 +51,9 @@ namespace OS {
|
||||
|
||||
Init();
|
||||
|
||||
int i = 1;
|
||||
// this only works well for a small number of directories,
|
||||
// which should be the common case.
|
||||
int i = RootPathID;
|
||||
for (const auto &e : _pathQueue)
|
||||
{
|
||||
if (e.hash == hash && e.path == path) return i;
|
||||
@ -82,7 +86,7 @@ namespace OS {
|
||||
|
||||
Init();
|
||||
|
||||
int i = 1;
|
||||
int i = RootPathID;
|
||||
for (const auto &e : _pathQueue)
|
||||
{
|
||||
if (e.hash == hash && e.path == path) return i;
|
||||
@ -102,10 +106,11 @@ namespace OS {
|
||||
|
||||
Init();
|
||||
|
||||
if (id < 1) return NullString;
|
||||
if (id > _pathQueue.size()) return NullString;
|
||||
id -= RootPathID;
|
||||
if (id < 0) return NullString;
|
||||
if (id >= _pathQueue.size()) return NullString;
|
||||
|
||||
return _pathQueue[id - 1].path;
|
||||
return _pathQueue[id].path;
|
||||
}
|
||||
|
||||
std::string FSSpecManager::ExpandPath(const std::string &path, int32_t id)
|
||||
|
Loading…
Reference in New Issue
Block a user