mirror of https://github.com/hyprwm/Hyprland
hyprpm: add duplicate header error and log more verbose in install fails
This commit is contained in:
parent
d9bc210285
commit
4190b96718
|
@ -157,15 +157,7 @@ bool CPluginManager::addNewPluginRepo(const std::string& url) {
|
||||||
const auto HEADERSSTATUS = headersValid();
|
const auto HEADERSSTATUS = headersValid();
|
||||||
|
|
||||||
if (HEADERSSTATUS != HEADERS_OK) {
|
if (HEADERSSTATUS != HEADERS_OK) {
|
||||||
|
std::cerr << "\n" << headerError(HEADERSSTATUS);
|
||||||
switch (HEADERSSTATUS) {
|
|
||||||
case HEADERS_CORRUPTED: std::cerr << "\n" << Colors::RED << "✖" << Colors::RESET << " Headers corrupted. Please run hyprpm update to fix those.\n"; break;
|
|
||||||
case HEADERS_MISMATCHED: std::cerr << "\n" << Colors::RED << "✖" << Colors::RESET << " Headers version mismatch. Please run hyprpm update to fix those.\n"; break;
|
|
||||||
case HEADERS_NOT_HYPRLAND: std::cerr << "\n" << Colors::RED << "✖" << Colors::RESET << " It doesn't seem you are running on hyprland.\n"; break;
|
|
||||||
case HEADERS_MISSING: std::cerr << "\n" << Colors::RED << "✖" << Colors::RESET << " Headers missing. Please run hyprpm update to fix those.\n"; break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,6 +277,10 @@ eHeadersErrors CPluginManager::headersValid() {
|
||||||
if (!ifs.good())
|
if (!ifs.good())
|
||||||
return HEADERS_CORRUPTED;
|
return HEADERS_CORRUPTED;
|
||||||
|
|
||||||
|
if ((std::filesystem::exists("/usr/include/hyprland/src/version.h") && verHeader != "/usr/include/hyprland/src/version.h") ||
|
||||||
|
(std::filesystem::exists("/usr/local/include/hyprland/src/version.h") && verHeader != "/usr/local/include/hyprland/src/version.h"))
|
||||||
|
return HEADERS_DUPLICATED;
|
||||||
|
|
||||||
std::string verHeaderContent((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>()));
|
std::string verHeaderContent((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>()));
|
||||||
ifs.close();
|
ifs.close();
|
||||||
|
|
||||||
|
@ -395,6 +391,8 @@ bool CPluginManager::updateHeaders() {
|
||||||
|
|
||||||
std::cout << "\n";
|
std::cout << "\n";
|
||||||
|
|
||||||
|
std::cerr << "\n" << headerError(HEADERSVALID);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,4 +685,21 @@ void CPluginManager::listAllPlugins() {
|
||||||
|
|
||||||
void CPluginManager::notify(const eNotifyIcons icon, uint32_t color, int durationMs, const std::string& message) {
|
void CPluginManager::notify(const eNotifyIcons icon, uint32_t color, int durationMs, const std::string& message) {
|
||||||
execAndGet("hyprctl notify " + std::to_string((int)icon) + " " + std::to_string(durationMs) + " " + std::to_string(color) + " " + message);
|
execAndGet("hyprctl notify " + std::to_string((int)icon) + " " + std::to_string(durationMs) + " " + std::to_string(color) + " " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CPluginManager::headerError(const eHeadersErrors err) {
|
||||||
|
switch (err) {
|
||||||
|
case HEADERS_CORRUPTED: return std::string{Colors::RED} + "✖" + Colors::RESET + " Headers corrupted. Please run hyprpm update to fix those.\n";
|
||||||
|
case HEADERS_MISMATCHED: return std::string{Colors::RED} + "✖" + Colors::RESET + " Headers version mismatch. Please run hyprpm update to fix those.\n";
|
||||||
|
case HEADERS_NOT_HYPRLAND: return std::string{Colors::RED} + "✖" + Colors::RESET + " It doesn't seem you are running on hyprland.\n";
|
||||||
|
case HEADERS_MISSING: return std::string{Colors::RED} + "✖" + Colors::RESET + " Headers missing. Please run hyprpm update to fix those.\n";
|
||||||
|
case HEADERS_DUPLICATED: {
|
||||||
|
return std::string{Colors::RED} + "✖" + Colors::RESET + " Headers duplicated!!! This is a very bad sign.\n" +
|
||||||
|
" This could be due to e.g. installing hyprland manually while a system package of hyprland is also installed.\n" +
|
||||||
|
" If the above doesn't apply, check your /usr/include and /usr/local/include directories\n and remove all the hyprland headers.\n";
|
||||||
|
}
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::string{Colors::RED} + "✖" + Colors::RESET + " Unknown header error. Please run hyprpm update to fix those.\n";
|
||||||
}
|
}
|
|
@ -9,6 +9,7 @@ enum eHeadersErrors {
|
||||||
HEADERS_MISSING,
|
HEADERS_MISSING,
|
||||||
HEADERS_CORRUPTED,
|
HEADERS_CORRUPTED,
|
||||||
HEADERS_MISMATCHED,
|
HEADERS_MISMATCHED,
|
||||||
|
HEADERS_DUPLICATED
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eNotifyIcons {
|
enum eNotifyIcons {
|
||||||
|
@ -54,6 +55,9 @@ class CPluginManager {
|
||||||
void notify(const eNotifyIcons icon, uint32_t color, int durationMs, const std::string& message);
|
void notify(const eNotifyIcons icon, uint32_t color, int durationMs, const std::string& message);
|
||||||
|
|
||||||
bool m_bVerbose = false;
|
bool m_bVerbose = false;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string headerError(const eHeadersErrors err);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::unique_ptr<CPluginManager> g_pPluginManager;
|
inline std::unique_ptr<CPluginManager> g_pPluginManager;
|
Loading…
Reference in New Issue