aboutsummaryrefslogtreecommitdiffstats
path: root/typesystem.cpp
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2010-01-08 16:53:02 -0200
committerLauro Neto <lauro.neto@openbossa.org>2010-01-08 18:35:11 -0300
commitc3c654e7b7322cc5b1a2e0148143311caa9d26a4 (patch)
treeefeae81d64aaf5c06f17961de6799c0ec4c0c361 /typesystem.cpp
parent8dded56b403fd979f0b567666017dc12f7c1a9b6 (diff)
Correctly search for typesystem in all available typesystem paths.
Reviewed by Lauro Moura <lauro.neto@openbossa.org>
Diffstat (limited to 'typesystem.cpp')
-rw-r--r--typesystem.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/typesystem.cpp b/typesystem.cpp
index f6c6d7e50..ca40332b6 100644
--- a/typesystem.cpp
+++ b/typesystem.cpp
@@ -1703,8 +1703,10 @@ TypeDatabase::TypeDatabase() : m_suppressWarnings(true)
QString TypeDatabase::modifiedTypesystemFilepath(const QString &ts_file)
{
if (!QFile::exists(ts_file)) {
+ int idx = ts_file.lastIndexOf('/');
+ QString fileName = idx >= 0 ? ts_file.right(ts_file.length() - idx - 1) : ts_file;
foreach (const QString &path, m_typesystemPaths) {
- QString filepath(path + '/' + ts_file);
+ QString filepath(path + '/' + fileName);
if (QFile::exists(filepath))
return filepath;
}
@@ -1714,18 +1716,13 @@ QString TypeDatabase::modifiedTypesystemFilepath(const QString &ts_file)
bool TypeDatabase::parseFile(const QString &filename, bool generate)
{
- QString filepath;
- if (filename[0] != '/')
- filepath = modifiedTypesystemFilepath(filename);
- else
- filepath = filename;
-
+ QString filepath = modifiedTypesystemFilepath(filename);
if (m_parsedTypesystemFiles.contains(filepath))
return m_parsedTypesystemFiles[filepath];
QFile file(filepath);
if (!file.exists()) {
- ReportHandler::warning("Can't find " + filename+", typesystme paths: "+m_typesystemPaths.join(", "));
+ ReportHandler::warning("Can't find " + filename+", typesystem paths: "+m_typesystemPaths.join(", "));
return false;
}