nixpkgs/pkgs/tools/graphics/mangohud/hardcode-dependencies.patch
2021-06-19 16:44:08 -04:00

58 lines
1.9 KiB
Diff

diff --git a/src/dbus.cpp b/src/dbus.cpp
index 44ffafc..9baf57b 100644
--- a/src/dbus.cpp
+++ b/src/dbus.cpp
@@ -162,7 +162,7 @@ bool dbus_manager::init(const std::string& requested_player) {
return true;
}
- if (!m_dbus_ldr.IsLoaded() && !m_dbus_ldr.Load("libdbus-1.so.3")) {
+ if (!m_dbus_ldr.IsLoaded() && !m_dbus_ldr.Load("@libdbus@/lib/libdbus-1.so.3")) {
std::cerr << "MANGOHUD: Could not load libdbus-1.so.3\n";
return false;
}
diff --git a/src/loaders/loader_x11.cpp b/src/loaders/loader_x11.cpp
index 25c65bf..87488d5 100644
--- a/src/loaders/loader_x11.cpp
+++ b/src/loaders/loader_x11.cpp
@@ -88,4 +88,4 @@ void libx11_loader::CleanUp(bool unload) {
}
-std::shared_ptr<libx11_loader> g_x11(new libx11_loader("libX11.so.6"));
+std::shared_ptr<libx11_loader> g_x11(new libx11_loader("@libX11@/lib/libX11.so.6"));
diff --git a/src/logging.cpp b/src/logging.cpp
index ee8600b..c7c91a0 100644
--- a/src/logging.cpp
+++ b/src/logging.cpp
@@ -19,7 +19,10 @@ string exec(string command) {
#ifdef __gnu_linux__
// Open pipe to file
+ char* originalPath = getenv("PATH");
+ setenv("PATH", "@path@", 1);
FILE* pipe = popen(command.c_str(), "r");
+ setenv("PATH", originalPath, 1);
if (!pipe) {
return "popen failed!";
}
diff --git a/src/pci_ids.cpp b/src/pci_ids.cpp
index 4e2a6d2..9490869 100644
--- a/src/pci_ids.cpp
+++ b/src/pci_ids.cpp
@@ -22,12 +22,9 @@ std::istream& get_uncommented_line(std::istream& is, std::string &line)
void parse_pciids()
{
- std::ifstream file("/usr/share/hwdata/pci.ids");
+ std::ifstream file("@hwdata@/share/hwdata/pci.ids");
if(file.fail()){
- std::ifstream file("/usr/share/misc/pci.ids");
- if (file.fail())
- printf("MANGOHUD: can't find file pci.ids\n");
-
+ printf("MANGOHUD: can't find file pci.ids\n");
}
std::string line;