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 );