From 614d720f4080ed516f8ac8ca509468dc1954ae2a Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Tue, 14 Apr 2020 18:06:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B0=20=D0=BD=D0=B0=D1=85=D0=BE=D0=B6=D0=B4?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D0=BD?= =?UTF-8?q?=D1=8F=D0=B5=D0=BC=D0=BE=D0=B3=D0=BE=20=D1=84=D0=B0=D0=B9=D0=BB?= =?UTF-8?q?=D0=B0=20=D0=B2=20=D0=BA=D0=B0=D1=82=D0=B0=D0=BB=D0=BE=D0=B3?= =?UTF-8?q?=D0=B5=20bin/unity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/myx/filesystem/paths.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/myx/filesystem/paths.cpp b/src/myx/filesystem/paths.cpp index 7285328..3cdeb12 100644 --- a/src/myx/filesystem/paths.cpp +++ b/src/myx/filesystem/paths.cpp @@ -15,9 +15,34 @@ Paths::Paths() = default; Paths::HierarchyType Paths::getHierarchyType() { + QRegExp binUnityRegexp( "/s*bin/unity$" ); QRegExp binRegexp( "/s*bin$" ); auto binaryDir = m_currentExecutable.m_canonicalFilePath.canonicalPath(); + if ( binUnityRegexp.indexIn( binaryDir ) >= 0 ) + { + binaryDir.remove( binUnityRegexp ); + + QFileInfo etcDirInfo { binaryDir + "/etc" }; + if ( !etcDirInfo.isDir() || !etcDirInfo.isReadable() ) { return( HierarchyType::kFlat ); } + + QFileInfo constDataDirInfo { binaryDir + "/files/data" }; + if ( !constDataDirInfo.isDir() || !constDataDirInfo.isReadable() ) { return( HierarchyType::kFlat ); } + + QFileInfo varDataDirInfo { binaryDir + "/files/lib" }; + if ( !varDataDirInfo.isDir() || !varDataDirInfo.isWritable() ) { return( HierarchyType::kFlat ); } + + QFileInfo logDirInfo { binaryDir + "/files/log" }; + if ( !logDirInfo.isDir() || !logDirInfo.isWritable() ) { return( HierarchyType::kFlat ); } + + m_systemConfigDirectory = etcDirInfo.canonicalFilePath(); + m_systemConstDataDirectory = constDataDirInfo.canonicalFilePath(); + m_systemVarDataDirectory = varDataDirInfo.canonicalFilePath(); + m_systemLogDirectory = logDirInfo.canonicalFilePath(); + + return ( HierarchyType::kDevelopment ); + } + if ( binRegexp.indexIn( binaryDir ) == -1 ) { return ( HierarchyType::kFlat );