Apparently the file names in the .debug_line section can be relative paths, not

only file names. Changed the FileManager::Get*File() method versions taking
directory path and file name to also accept relative file paths. They just join
the paths and use the single-argument versions, which now does all the work.
Fixes finding source files for which a relative path is given in .debug_line.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31394 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-07-03 14:46:10 +00:00
parent d9b10dea3b
commit a61e0d36a0
2 changed files with 21 additions and 18 deletions
+19 -16
View File
@@ -124,11 +124,20 @@ public:
return B_OK; return B_OK;
} }
LocatableFile* GetFile(const BString& directoryPath, const BString& name) LocatableFile* GetFile(const BString& directoryPath,
const BString& relativePath)
{ {
BString normalizedDirectoryPath; if (directoryPath.Length() == 0)
_NormalizePath(directoryPath, normalizedDirectoryPath); return GetFile(relativePath);
LocatableFile* file = _GetFile(normalizedDirectoryPath, name); return GetFile(BString(directoryPath) << '/' << relativePath);
}
LocatableFile* GetFile(const BString& path)
{
BString directoryPath;
BString name;
_SplitPath(path, directoryPath, name);
LocatableFile* file = _GetFile(directoryPath, name);
if (file == NULL) if (file == NULL)
return NULL; return NULL;
@@ -150,14 +159,6 @@ public:
return file; return file;
} }
LocatableFile* GetFile(const BString& path)
{
BString directoryPath;
BString name;
_SplitPath(path, directoryPath, name);
return _GetFile(directoryPath, name);
}
void EntryLocated(const BString& path, const BString& locatedPath) void EntryLocated(const BString& path, const BString& locatedPath)
{ {
BString directory; BString directory;
@@ -580,10 +581,11 @@ FileManager::Init(bool targetIsLocal)
LocatableFile* LocatableFile*
FileManager::GetTargetFile(const BString& directory, const BString& name) FileManager::GetTargetFile(const BString& directory,
const BString& relativePath)
{ {
AutoLocker<FileManager> locker(this); AutoLocker<FileManager> locker(this);
return fTargetDomain->GetFile(directory, name); return fTargetDomain->GetFile(directory, relativePath);
} }
@@ -604,10 +606,11 @@ FileManager::TargetEntryLocated(const BString& path, const BString& locatedPath)
LocatableFile* LocatableFile*
FileManager::GetSourceFile(const BString& directory, const BString& name) FileManager::GetSourceFile(const BString& directory,
const BString& relativePath)
{ {
AutoLocker<FileManager> locker(this); AutoLocker<FileManager> locker(this);
return fSourceDomain->GetFile(directory, name); return fSourceDomain->GetFile(directory, relativePath);
} }
+2 -2
View File
@@ -26,7 +26,7 @@ public:
void Unlock() { fLock.Unlock(); } void Unlock() { fLock.Unlock(); }
LocatableFile* GetTargetFile(const BString& directory, LocatableFile* GetTargetFile(const BString& directory,
const BString& name); const BString& relativePath);
// returns a reference // returns a reference
LocatableFile* GetTargetFile(const BString& path); LocatableFile* GetTargetFile(const BString& path);
// returns a reference // returns a reference
@@ -34,7 +34,7 @@ public:
const BString& locatedPath); const BString& locatedPath);
LocatableFile* GetSourceFile(const BString& directory, LocatableFile* GetSourceFile(const BString& directory,
const BString& name); const BString& relativePath);
// returns a reference // returns a reference
LocatableFile* GetSourceFile(const BString& path); LocatableFile* GetSourceFile(const BString& path);
// returns a reference // returns a reference