mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
Close #304 oids.txt not found etc if prefix non-standard
Add INSTALL_PREFIX to the header and add it to the search path for OIDs, translations and documentation.
This commit is contained in:
parent
3ac87b580b
commit
0212113424
18
lib/func.cpp
18
lib/func.cpp
@ -221,6 +221,9 @@ const QString getDocDir()
|
||||
QStringList docs;
|
||||
#ifdef DOCDIR
|
||||
docs << QString(DOCDIR);
|
||||
#endif
|
||||
#ifdef INSTALL_DATA_PREFIX
|
||||
docs << QString(INSTALL_DATA_PREFIX);
|
||||
#endif
|
||||
docs += QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
|
||||
foreach (docdir, docs) {
|
||||
@ -260,12 +263,21 @@ const QString getUserSettingsDir()
|
||||
|
||||
const QString getI18nDir()
|
||||
{
|
||||
QString qm = QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
I18N_DIR "xca_de.qm");
|
||||
static QString qm;
|
||||
if (!qm.isEmpty())
|
||||
return qm;
|
||||
#ifdef INSTALL_DATA_PREFIX
|
||||
if (QFileInfo::exists(INSTALL_DATA_PREFIX "/xca_de.qm"))
|
||||
qm = INSTALL_DATA_PREFIX "/xca_de.qm";
|
||||
#endif
|
||||
if (qm.isEmpty())
|
||||
qm = QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
I18N_DIR "xca_de.qm");
|
||||
if (qm.isEmpty())
|
||||
qm = QCoreApplication::applicationDirPath() + "/xca_de.qm";
|
||||
qm = QFileInfo(qm).path();
|
||||
qDebug() << "QM" << qm;
|
||||
return QFileInfo(qm).path();
|
||||
return qm;
|
||||
}
|
||||
|
||||
void migrateOldPaths()
|
||||
|
||||
18
lib/oid.cpp
18
lib/oid.cpp
@ -25,6 +25,16 @@ NIDlist distname_nid;
|
||||
QMap<QString,const char*> oid_name_clash;
|
||||
QMap<QString,int> oid_lower_map;
|
||||
|
||||
static QStringList searchdirs()
|
||||
{
|
||||
QStringList dirs = QStandardPaths::standardLocations(
|
||||
QStandardPaths::AppDataLocation);
|
||||
#ifdef INSTALL_DATA_PREFIX
|
||||
dirs << QString(INSTALL_DATA_PREFIX);
|
||||
#endif
|
||||
return dirs;
|
||||
}
|
||||
|
||||
static void addToLowerMap(int nid)
|
||||
{
|
||||
QString n = OBJ_nid2sn(nid);
|
||||
@ -120,7 +130,7 @@ static void readOIDs(const QString &fname)
|
||||
int line = 0;
|
||||
QFile file(fname);
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
return;
|
||||
return;
|
||||
qDebug() << "Read additional OIDs from" << fname;
|
||||
QTextStream in(&file);
|
||||
while (!in.atEnd()) {
|
||||
@ -171,8 +181,7 @@ static NIDlist read_nidlist(const QString &name)
|
||||
{
|
||||
NIDlist nl;
|
||||
|
||||
foreach(QString d, QStandardPaths::standardLocations(
|
||||
QStandardPaths::AppDataLocation))
|
||||
foreach(QString d, searchdirs())
|
||||
{
|
||||
nl = readNIDlist(d + "/" + name);
|
||||
qDebug() << "Read" << nl.count() << "NIDs from"
|
||||
@ -191,8 +200,7 @@ void initOIDs()
|
||||
addToLowerMap(i);
|
||||
ign_openssl_error();
|
||||
|
||||
foreach(QString d, QStandardPaths::standardLocations(
|
||||
QStandardPaths::AppDataLocation))
|
||||
foreach(QString d, searchdirs())
|
||||
readOIDs(d + "/oids.txt");
|
||||
|
||||
extkeyuse_nid = read_nidlist("eku.txt");
|
||||
|
||||
@ -11,3 +11,8 @@
|
||||
|
||||
/* Build an AppStore compliant version */
|
||||
#cmakedefine APPSTORE_COMPLIANT
|
||||
|
||||
/* Install PREFIX (linux only) */
|
||||
#if defined Q_OS_UNIX && ! defined Q_OS_MACOS
|
||||
#define INSTALL_DATA_PREFIX "@CMAKE_INSTALL_PREFIX@/share/xca"
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user