diff --git a/app/install.sh b/app/install.sh index 7a9d10c..85f874b 100755 --- a/app/install.sh +++ b/app/install.sh @@ -12,7 +12,8 @@ cmake -S "$path/.." -B "$path/../build" \ cmake --build "$path/../build" --config Release -- -j"$(nproc)" if [ ! -w "$prefix" ] && [ "$(id -u)" -ne 0 ]; then - sudo cmake --install "$path/../build" --config Release + echo "Elevated permissions are required to install to $prefix, enter root's password to continue." + su -m -c "cmake --install '$path/../build' --config Release" root else cmake --install "$path/../build" --config Release fi diff --git a/src/utils.h b/src/utils.h index dfc45be..1074883 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,7 +1,7 @@ /* * @Author: Uyanide pywang0608@foxmail.com * @Date: 2025-11-30 20:59:57 - * @LastEditTime: 2026-01-15 06:00:51 + * @LastEditTime: 2026-01-15 09:55:26 * @Description: THE utils header that every project needs :) */ @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -132,12 +133,9 @@ inline bool checkImageFile(const QString& filePath) { return false; } // check if valid extension - for (const QString& ext : validExtensions) { - if (filePath.endsWith(ext, Qt::CaseInsensitive)) { - return true; - } - } - return false; + static const QList formats = QImageReader::supportedImageFormats(); + QString ext = QFileInfo(filePath).suffix().toLower(); + return formats.contains(ext.toUtf8()); } #endif // UTILS_H