mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
add package compatible
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QApplication>
|
||||
#include <QFileInfo>
|
||||
|
||||
namespace NekoRay {
|
||||
|
||||
@@ -324,4 +326,22 @@ namespace NekoRay {
|
||||
return ok;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
QString FindCoreAsset(const QString &name) {
|
||||
QStringList search{dataStore->v2ray_asset_dir};
|
||||
search << QApplication::applicationDirPath();
|
||||
search << "/usr/share/v2ray";
|
||||
search << "/usr/local/share/v2ray";
|
||||
search << "/opt/v2ray";
|
||||
for (const auto &dir: search) {
|
||||
if (dir.isEmpty()) continue;
|
||||
QFileInfo asset(dir + "/" + name);
|
||||
if (asset.exists()) {
|
||||
return asset.absoluteFilePath();
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user