nixpkgs/pkgs/tools/graphics/mangohud/hardcode-dependencies.patch
2021-05-11 12:52:12 -04:00

58 lines
1.9 KiB
Diff

diff --git a/src/dbus.cpp b/src/dbus.cpp
index 0acccc3..7dd7c49 100644
--- a/src/dbus.cpp
+++ b/src/dbus.cpp
@@ -157,7 +157,7 @@ bool dbus_manager::init(const std::string& requested_player) {
m_requested_player = "org.mpris.MediaPlayer2." + requested_player;
}
- 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 f2c4271..d33e793 100644
--- a/src/logging.cpp
+++ b/src/logging.cpp
@@ -17,7 +17,10 @@ string exec(string command) {
string result = "";
// 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;