LocatableFile* GetFile(const BString& path) { BString directoryPath; BString name; _SplitPath(path, directoryPath, name); LocatableFile* file = _GetFile(directoryPath, name); if (file == NULL) return NULL; // try to auto-locate the file if (LocatableDirectory* directory = file->Parent()) { if (directory->State() == LOCATABLE_ENTRY_UNLOCATED) { // parent not yet located -- try locate with the entry's path BString path; file->GetPath(path); _LocateEntry(file, path, true, true); } else { // parent already located -- locate the entry in the parent BString locatedDirectoryPath; if (directory->GetLocatedPath(locatedDirectoryPath)) _LocateEntryInParentDir(file, locatedDirectoryPath, true); } } return file; }
QString Database::GetFile(int id) { QMutexLocker locker(&lock); return _GetFile(id); }