diff --git a/modules/settings/utils/helpers/getAvailableSkins.helper.php b/modules/settings/utils/helpers/getAvailableSkins.helper.php index 6a701caf..c26da6c7 100644 --- a/modules/settings/utils/helpers/getAvailableSkins.helper.php +++ b/modules/settings/utils/helpers/getAvailableSkins.helper.php @@ -2,7 +2,13 @@ namespace UniEngine\Engine\Modules\Settings\Utils\Helpers; -function getAvailableSkins() { +/** + * @param array $params + * @param string $params['rootDir'] (default: "./") + */ +function getAvailableSkins($params = []) { + $rootDir = !empty($params['rootDir']) ? $params['rootDir'] : "./"; + $knownSkinNames = [ 'xnova' => 'XNova', 'epicblue' => 'EpicBlue Fresh', @@ -10,7 +16,7 @@ function getAvailableSkins() { ]; $skinsDir = 'skins'; - $skinsDirEntries = scandir("./{$skinsDir}/"); + $skinsDirEntries = scandir("{$rootDir}/{$skinsDir}/"); $skinsDirEntries = !empty($skinsDirEntries) ? $skinsDirEntries : []; $availableSkins = []; @@ -18,7 +24,7 @@ function getAvailableSkins() { foreach ($skinsDirEntries as $skinDirEntry) { if ( strstr($skinDirEntry, '.') !== false || - !is_dir("./skins/{$skinDirEntry}") + !is_dir("{$rootDir}/skins/{$skinDirEntry}") ) { continue; }