StelFileMgr.cpp   StelFileMgr.cpp 
skipping to change at line 132 skipping to change at line 132
foreach (QString i, fileLocations) foreach (QString i, fileLocations)
{ {
if (fileFlagsCheck(i + "/" + path, flags)) if (fileFlagsCheck(i + "/" + path, flags))
return i + "/" + path; return i + "/" + path;
} }
throw std::runtime_error(QString("file not found: %1").arg(path).toL ocal8Bit().constData()); throw std::runtime_error(QString("file not found: %1").arg(path).toL ocal8Bit().constData());
} }
QStringList StelFileMgr::findFileInAllPaths(const QString &path, const Flag
s &flags)
{
if (path.isEmpty())
throw std::runtime_error("Empty file path");
QStringList filePaths;
// explicitly specified relative paths
if (path[0] == '.')
{
if (fileFlagsCheck(path, flags))
{
filePaths.append(path);
return filePaths;
}
else
throw std::runtime_error(QString("file does not matc
h flags: %1").arg(path).toLocal8Bit().constData());
}
// Qt resource files
if (path.startsWith(":/"))
{
filePaths.append(path);
return filePaths;
}
// explicitly specified absolute paths
if ( isAbsolute(path) )
{
if (fileFlagsCheck(path, flags))
{
filePaths.append(path);
return filePaths;
}
else
throw std::runtime_error(QString("file does not matc
h flags: %1").arg(path).toLocal8Bit().constData());
}
foreach (QString locationPath, fileLocations)
{
if (fileFlagsCheck(locationPath + "/" + path, flags))
{
filePaths.append(locationPath + "/" + path);
}
}
if (filePaths.isEmpty())
throw std::runtime_error(QString("file not found: %1").arg(p
ath).toLocal8Bit().constData());
else
return filePaths;
}
QSet<QString> StelFileMgr::listContents(const QString& path, const StelFile Mgr::Flags& flags, bool recursive) QSet<QString> StelFileMgr::listContents(const QString& path, const StelFile Mgr::Flags& flags, bool recursive)
{ {
QSet<QString> result; QSet<QString> result;
QStringList listPaths; QStringList listPaths;
if (recursive) if (recursive)
{ {
QSet<QString> dirs = listContents(path, Directory, false); QSet<QString> dirs = listContents(path, Directory, false);
result = listContents(path, flags, false); // root result = listContents(path, flags, false); // root
// add results for each sub-directory // add results for each sub-directory
skipping to change at line 350 skipping to change at line 402
} }
QString StelFileMgr::getInstallationDir() QString StelFileMgr::getInstallationDir()
{ {
// If we are running from the build tree, we use the files from ther e... // If we are running from the build tree, we use the files from ther e...
if (QFileInfo(CHECK_FILE).exists()){ if (QFileInfo(CHECK_FILE).exists()){
return "."; return ".";
} }
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
QFileInfo MacOSdir(QCoreApplication::applicationDirPath() + "/../Res QString relativePath = "/../Resources";
ources"); if (QCoreApplication::applicationDirPath().contains("src")) {
relativePath = "/../../../../..";
}
QFileInfo MacOSdir(QCoreApplication::applicationDirPath() + relative
Path);
QDir ResourcesDir = MacOSdir.dir(); QDir ResourcesDir = MacOSdir.dir();
ResourcesDir.cd(QString("Resources")); if (!QCoreApplication::applicationDirPath().contains("src")) {
ResourcesDir.cd(QString("Resources"));
}
QFileInfo installLocation(ResourcesDir.absolutePath()); QFileInfo installLocation(ResourcesDir.absolutePath());
QFileInfo checkFile(installLocation.filePath() + QString("/") + QStr ing(CHECK_FILE)); QFileInfo checkFile(installLocation.filePath() + QString("/") + QStr ing(CHECK_FILE));
#else #else
// Linux, BSD, Solaris etc. // Linux, BSD, Solaris etc.
// We use the value from the config.h filesystem // We use the value from the config.h filesystem
QFileInfo installLocation(QFile::decodeName(INSTALL_DATADIR)); QFileInfo installLocation(QFile::decodeName(INSTALL_DATADIR));
QFileInfo checkFile(QFile::decodeName(INSTALL_DATADIR "/" CHECK_FILE )); QFileInfo checkFile(QFile::decodeName(INSTALL_DATADIR "/" CHECK_FILE ));
#endif #endif
if (checkFile.exists()) if (checkFile.exists())
 End of changes. 3 change blocks. 
3 lines changed or deleted 66 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/