mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-17 18:27:25 -05:00
Don't add double "/" to paths.
This commit is contained in:
parent
3100c202e8
commit
f01076856b
src/core
@ -27,7 +27,12 @@ FilePath* FilePath::m_instance(Q_NULLPTR);
|
|||||||
|
|
||||||
QString FilePath::dataPath(const QString& name)
|
QString FilePath::dataPath(const QString& name)
|
||||||
{
|
{
|
||||||
return m_basePath + name;
|
if (name.isEmpty() || name.startsWith('/')) {
|
||||||
|
return m_dataPath + name;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return m_dataPath + "/" + name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FilePath::pluginPath(const QString& name)
|
QString FilePath::pluginPath(const QString& name)
|
||||||
@ -76,12 +81,12 @@ QIcon FilePath::icon(const QString& category, const QString& name, bool fromThem
|
|||||||
pngSizes << "16" << "22" << "24" << "32" << "48" << "64" << "128";
|
pngSizes << "16" << "22" << "24" << "32" << "48" << "64" << "128";
|
||||||
QString filename;
|
QString filename;
|
||||||
Q_FOREACH (const QString& size, pngSizes) {
|
Q_FOREACH (const QString& size, pngSizes) {
|
||||||
filename = QString("%1/icons/application/%2x%2/%3/%4.png").arg(m_basePath, size, category, name);
|
filename = QString("%1/icons/application/%2x%2/%3/%4.png").arg(m_dataPath, size, category, name);
|
||||||
if (QFile::exists(filename)) {
|
if (QFile::exists(filename)) {
|
||||||
icon.addFile(filename);
|
icon.addFile(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filename = QString("%1/icons/application/scalable/%3/%4.svgz").arg(m_basePath, category, name);
|
filename = QString("%1/icons/application/scalable/%3/%4.svgz").arg(m_dataPath, category, name);
|
||||||
if (QFile::exists(filename)) {
|
if (QFile::exists(filename)) {
|
||||||
icon.addFile(filename);
|
icon.addFile(filename);
|
||||||
}
|
}
|
||||||
@ -111,18 +116,18 @@ FilePath::FilePath()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_basePath.isEmpty()) {
|
if (m_dataPath.isEmpty()) {
|
||||||
qWarning("DataPath::DataPath: can't find data dir");
|
qWarning("FilePath::DataPath: can't find data dir");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_basePath = QDir::cleanPath(m_basePath) + "/";
|
m_dataPath = QDir::cleanPath(m_dataPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilePath::testSetDir(const QString& dir)
|
bool FilePath::testSetDir(const QString& dir)
|
||||||
{
|
{
|
||||||
if (QFile::exists(dir + "/icons/database/C00_Password.png")) {
|
if (QFile::exists(dir + "/icons/database/C00_Password.png")) {
|
||||||
m_basePath = dir;
|
m_dataPath = dir;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -39,7 +39,7 @@ private:
|
|||||||
|
|
||||||
static FilePath* m_instance;
|
static FilePath* m_instance;
|
||||||
|
|
||||||
QString m_basePath;
|
QString m_dataPath;
|
||||||
|
|
||||||
Q_DISABLE_COPY(FilePath)
|
Q_DISABLE_COPY(FilePath)
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user