From 4615bd0e23288c2d5943c95babcad80305ad6f4b Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Sun, 21 Sep 2014 14:19:03 -0500 Subject: 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. --- src/main.cpp | 19 +++++++++++-------- 1 file 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 #include #include +#include #include #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 -- cgit v1.2.3