diff options
author | Ruben Pollan <meskio@sindominio.net> | 2014-09-21 14:19:03 -0500 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2014-09-21 14:19:03 -0500 |
commit | 4615bd0e23288c2d5943c95babcad80305ad6f4b (patch) | |
tree | 6bbf48419eb81290a8f26989e0d4226ac2d8c9c5 | |
parent | 3b45e320964edee7cd9b114935ead200ff8e9c3a (diff) |
Make symlinks instead of moving libraries around
The updater has problems with moving files, as it things that the
dissapear file is missing and needs to be updated. Instead we keep
libQt* libs as lib/libQt*.non-ubuntu and make symlinks to them in case
of needed by the platform.
-rw-r--r-- | src/main.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp index d2f744a..eb709e9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,6 +3,7 @@ #include <string> #include <cmath> #include <cstdlib> +#include <unistd.h> #include <boost/python.hpp> #define BOOST_NO_CXX11_SCOPED_ENUMS @@ -123,23 +124,25 @@ main(int argc, char** argv) auto pypath = full_path.string() + "/apps/:" + full_path.string() + "/lib/"; std::cout << pypath << std::endl; #if not defined _WIN32 && not defined _WIN64 - fs::path fromCore("./lib/libQtCore.so.4"); - fs::path toCore("./lib/libQtCore.NOTUSED"); - fs::path fromGui("./lib/libQtGui.so.4"); - fs::path toGui("./lib/libQtGui.NOTUSED"); + chdir("lib"); + fs::path fromCore("libQtCore.non-ubuntu"); + fs::path toCore("libQtCore.so.4"); + fs::path fromGui("libQtGui.non-ubuntu"); + fs::path toGui("libQtGui.so.4"); try { auto desk = std::string(getenv("DESKTOP_SESSION")); if(boost::starts_with(desk, "ubuntu")) { - fs::rename(fromCore, toCore); - fs::rename(fromGui, toGui); + fs::remove(toCore); + fs::remove(toGui); } else { - fs::rename(toCore, fromCore); - fs::rename(toGui, fromGui); + fs::create_symlink(fromCore, toCore); + fs::create_symlink(fromGui, toGui); } } catch(...) { } + chdir(".."); setenv("PYTHONPATH", pypath.c_str(), 1); #endif |