From 7ca22b2b0e45e14f58bca6ba7ccb5d60563637c7 Mon Sep 17 00:00:00 2001
From: "a.yankovich" <EndrIIMail@gmail.com>
Date: Tue, 25 Feb 2020 15:18:14 +0300
Subject: [PATCH] fix #287

---
 Deploy/deploycore.cpp | 9 +++++++++
 Deploy/deploycore.h   | 5 ++++-
 Deploy/extracter.cpp  | 4 ++--
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Deploy/deploycore.cpp b/Deploy/deploycore.cpp
index 21c6ad7..85cdadb 100644
--- a/Deploy/deploycore.cpp
+++ b/Deploy/deploycore.cpp
@@ -128,6 +128,10 @@ LibPriority DeployCore::getLibPriority(const QString &lib) {
         return ExtraLib;
     }
 
+    if (isAlienLib(lib)) {
+        return AlienLib;
+    }
+
     return SystemLib;
 }
 
@@ -478,6 +482,11 @@ bool DeployCore::isExtraLib(const QString &lib) {
     return _config->extraPaths.contains(info.absoluteFilePath());
 }
 
+bool DeployCore::isAlienLib(const QString &lib) {
+    return lib.contains("/opt/", ONLY_WIN_CASE_INSENSIATIVE) ||
+           lib.contains("/PROGRAM FILES", ONLY_WIN_CASE_INSENSIATIVE);
+}
+
 QChar DeployCore::getSeparator(int lvl) {
     switch (lvl) {
     case 0:  return ',';
diff --git a/Deploy/deploycore.h b/Deploy/deploycore.h
index 86dbc74..aa73384 100644
--- a/Deploy/deploycore.h
+++ b/Deploy/deploycore.h
@@ -46,7 +46,8 @@ enum LibPriority : int {
     QtLib = 0x0,
     ExtraLib,
     SystemLib,
-    ExtraFile,
+    AlienLib,
+//    ExtraFile,
     NotFile = 0xF,
 };
 
@@ -150,6 +151,8 @@ public:
     static bool isQtLib(const QString &lib);
     static bool isExtraLib(const QString &lib);
     static QChar getSeparator(int lvl);
+    static bool isAlienLib(const QString &lib);
+
     static char getEnvSeparator();
 
     static LibPriority getLibPriority(const QString &lib);
diff --git a/Deploy/extracter.cpp b/Deploy/extracter.cpp
index a5a3a8f..3d33be3 100644
--- a/Deploy/extracter.cpp
+++ b/Deploy/extracter.cpp
@@ -329,11 +329,11 @@ void Extracter::extractLib(const QString &file,
             continue;
         }
 
-        if (line.getPriority() != LibPriority::SystemLib && !depMap->containsNeadedLib(line.fullPath())) {
+        if (line.getPriority() < LibPriority::SystemLib && !depMap->containsNeadedLib(line.fullPath())) {
             depMap->addNeadedLib(line.fullPath());
 
         } else if (QuasarAppUtils::Params::isEndable("deploySystem") &&
-                    line.getPriority() == LibPriority::SystemLib &&
+                    line.getPriority() >= LibPriority::SystemLib &&
                     !depMap->containsSysLib(line.fullPath())) {
 
             depMap->addSystemLib(line.fullPath());