Utilities: Handle missing XDG_DATA_DIRS variable

This commit is contained in:
Jonas Kvinge 2024-04-02 16:39:48 +02:00
parent 05c4d23df6
commit c00d95242d
1 changed files with 5 additions and 1 deletions

View File

@ -50,7 +50,11 @@ void OpenInFileManager(const QString &path, const QUrl &url) {
#endif #endif
proc.waitForFinished(); proc.waitForFinished();
QString desktop_file = proc.readLine().simplified(); QString desktop_file = proc.readLine().simplified();
QStringList data_dirs = QString(qgetenv("XDG_DATA_DIRS")).split(":"); QString xdg_data_dirs = QString(qgetenv("XDG_DATA_DIRS"));
if (xdg_data_dirs.isEmpty()) {
xdg_data_dirs = "/usr/local/share/:/usr/share/";
}
QStringList data_dirs = xdg_data_dirs.split(":");
QString command; QString command;
QStringList command_params; QStringList command_params;