fixing the tscn.remap on exported projects
This commit is contained in:
parent
928f26f393
commit
fddec6b963
1 changed files with 7 additions and 5 deletions
|
|
@ -5,9 +5,9 @@ class_name Helper
|
|||
const CONFIRM_POPUP : PackedScene = preload("uid://cxn3x8dq8vawa")
|
||||
|
||||
|
||||
const SCENE_DIR_PATTERN : String = "res://\\w+/(Scenes|Map \\d+)/$"
|
||||
const SCENE_FILE_PATTERN : String = "([^/]*)\\.t?scn$"
|
||||
const RESOURCE_FILE_PATTERN : String = "([^/]*)\\.t?res$"
|
||||
const SCENE_DIR_PATTERN : String = "res://\\w+/(Scenes|Map \\d+)/(.remap)?$"
|
||||
const SCENE_FILE_PATTERN : String = "([^/]*)\\.t?scn(.remap)?$"
|
||||
const RESOURCE_FILE_PATTERN : String = "([^/]*)\\.t?res(.remap)?$"
|
||||
|
||||
const TOWER_DIR : String = "res://Towers/Scenes/"
|
||||
const ENEMY_DIR : String = "res://Enemies/Scenes/"
|
||||
|
|
@ -36,6 +36,7 @@ static func getPackedScenesPaths(type: RESOURCE_TYPE) -> Array[String]:
|
|||
return getFileFromDir(getDirFromType(type), SCENE_FILE_PATTERN, SCENE_DIR_PATTERN)
|
||||
|
||||
|
||||
|
||||
static func getResourcesPaths(type: RESOURCE_TYPE) -> Array[String]:
|
||||
if type == RESOURCE_TYPE.LEVEL:
|
||||
return getFileFromDir(getDirFromType(type), RESOURCE_FILE_PATTERN, LEVEL_DIR)
|
||||
|
|
@ -55,7 +56,7 @@ static func getFileFromDir(path : String, regexPattern : String, pathRegexPatter
|
|||
var regex : RegEx = RegEx.create_from_string(regexPattern)
|
||||
var pathRegex : RegEx = RegEx.create_from_string(pathRegexPattern)
|
||||
var dir : DirAccess = DirAccess.open(path)
|
||||
|
||||
print(path, " ", dir, " ", dir.get_files())
|
||||
if pathRegexPattern:
|
||||
for subDir in dir.get_directories():
|
||||
subDir = path + subDir + "/"
|
||||
|
|
@ -63,9 +64,10 @@ static func getFileFromDir(path : String, regexPattern : String, pathRegexPatter
|
|||
files.append_array(getFileFromDir(subDir, regexPattern, pathRegexPattern))
|
||||
|
||||
for file in dir.get_files():
|
||||
print("regex : ", regex.search(file) && pathRegex.search(path))
|
||||
if regex.search(file) && pathRegex.search(path):
|
||||
files.append(path + file)
|
||||
|
||||
print(files)
|
||||
return files
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue