Проверка на нахождение исполняемого файла в каталоге bin/unity
This commit is contained in:
parent
78ecc0f7c0
commit
614d720f40
@ -15,9 +15,34 @@ Paths::Paths() = default;
|
|||||||
|
|
||||||
Paths::HierarchyType Paths::getHierarchyType()
|
Paths::HierarchyType Paths::getHierarchyType()
|
||||||
{
|
{
|
||||||
|
QRegExp binUnityRegexp( "/s*bin/unity$" );
|
||||||
QRegExp binRegexp( "/s*bin$" );
|
QRegExp binRegexp( "/s*bin$" );
|
||||||
auto binaryDir = m_currentExecutable.m_canonicalFilePath.canonicalPath();
|
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 )
|
if ( binRegexp.indexIn( binaryDir ) == -1 )
|
||||||
{
|
{
|
||||||
return ( HierarchyType::kFlat );
|
return ( HierarchyType::kFlat );
|
||||||
|
Loading…
Reference in New Issue
Block a user