From a1d34d4c32534c695236afb65b232cc4f80a36a4 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Sat, 4 Apr 2020 14:14:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20=D0=BE?= =?UTF-8?q?=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BF=D1=83=D1=82=D0=B5=D0=B9=20=D0=B4=D0=BB=D1=8F=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BF=D0=BE=D0=BB=D0=BD=D1=8F=D0=B5=D0=BC=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20=D0=B2=20=D0=BA=D0=B0?= =?UTF-8?q?=D1=82=D0=B0=D0=BB=D0=BE=D0=B3=D0=B5=20/opt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/myx/filesystem/paths.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/myx/filesystem/paths.cpp b/src/myx/filesystem/paths.cpp index 456773e..65e246a 100644 --- a/src/myx/filesystem/paths.cpp +++ b/src/myx/filesystem/paths.cpp @@ -23,18 +23,21 @@ Paths::HierarchyType Paths::getHierarchyType() return ( HierarchyType::kFlat ); } - if ( binaryDir.startsWith( "/opt" ) ) + QRegExp optRegexp( "^/opt(/|/.+/)" + m_projectName + "/" ); + + if ( optRegexp.indexIn( binaryDir ) >= 0 ) { - QFileInfo etcDirInfo { "/opt/" + m_projectName + "/etc" }; + binaryDir.remove( binRegexp ); + QFileInfo etcDirInfo { binaryDir + "/etc" }; if ( !etcDirInfo.isDir() || !etcDirInfo.isReadable() ) { return( HierarchyType::kFlat ); } - QFileInfo constDataDirInfo { "/opt/" + m_projectName + "/files/data" }; + QFileInfo constDataDirInfo { binaryDir + "/files/data" }; if ( !constDataDirInfo.isDir() || !constDataDirInfo.isReadable() ) { return( HierarchyType::kFlat ); } - QFileInfo varDataDirInfo { "/opt/" + m_projectName + "/files/lib" }; + QFileInfo varDataDirInfo { binaryDir + "/files/lib" }; if ( !varDataDirInfo.isDir() || !varDataDirInfo.isWritable() ) { return( HierarchyType::kFlat ); } - QFileInfo logDirInfo { "/opt/" + m_projectName + "/files/log" }; + QFileInfo logDirInfo { binaryDir + "/files/log" }; if ( !logDirInfo.isDir() || !logDirInfo.isWritable() ) { return( HierarchyType::kFlat ); } m_systemConfigDirectory = etcDirInfo.canonicalFilePath();