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 CONFIRM_POPUP : PackedScene = preload("uid://cxn3x8dq8vawa")
|
||||||
|
|
||||||
|
|
||||||
const SCENE_DIR_PATTERN : String = "res://\\w+/(Scenes|Map \\d+)/$"
|
const SCENE_DIR_PATTERN : String = "res://\\w+/(Scenes|Map \\d+)/(.remap)?$"
|
||||||
const SCENE_FILE_PATTERN : String = "([^/]*)\\.t?scn$"
|
const SCENE_FILE_PATTERN : String = "([^/]*)\\.t?scn(.remap)?$"
|
||||||
const RESOURCE_FILE_PATTERN : String = "([^/]*)\\.t?res$"
|
const RESOURCE_FILE_PATTERN : String = "([^/]*)\\.t?res(.remap)?$"
|
||||||
|
|
||||||
const TOWER_DIR : String = "res://Towers/Scenes/"
|
const TOWER_DIR : String = "res://Towers/Scenes/"
|
||||||
const ENEMY_DIR : String = "res://Enemies/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)
|
return getFileFromDir(getDirFromType(type), SCENE_FILE_PATTERN, SCENE_DIR_PATTERN)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static func getResourcesPaths(type: RESOURCE_TYPE) -> Array[String]:
|
static func getResourcesPaths(type: RESOURCE_TYPE) -> Array[String]:
|
||||||
if type == RESOURCE_TYPE.LEVEL:
|
if type == RESOURCE_TYPE.LEVEL:
|
||||||
return getFileFromDir(getDirFromType(type), RESOURCE_FILE_PATTERN, LEVEL_DIR)
|
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 regex : RegEx = RegEx.create_from_string(regexPattern)
|
||||||
var pathRegex : RegEx = RegEx.create_from_string(pathRegexPattern)
|
var pathRegex : RegEx = RegEx.create_from_string(pathRegexPattern)
|
||||||
var dir : DirAccess = DirAccess.open(path)
|
var dir : DirAccess = DirAccess.open(path)
|
||||||
|
print(path, " ", dir, " ", dir.get_files())
|
||||||
if pathRegexPattern:
|
if pathRegexPattern:
|
||||||
for subDir in dir.get_directories():
|
for subDir in dir.get_directories():
|
||||||
subDir = path + subDir + "/"
|
subDir = path + subDir + "/"
|
||||||
|
|
@ -63,9 +64,10 @@ static func getFileFromDir(path : String, regexPattern : String, pathRegexPatter
|
||||||
files.append_array(getFileFromDir(subDir, regexPattern, pathRegexPattern))
|
files.append_array(getFileFromDir(subDir, regexPattern, pathRegexPattern))
|
||||||
|
|
||||||
for file in dir.get_files():
|
for file in dir.get_files():
|
||||||
|
print("regex : ", regex.search(file) && pathRegex.search(path))
|
||||||
if regex.search(file) && pathRegex.search(path):
|
if regex.search(file) && pathRegex.search(path):
|
||||||
files.append(path + file)
|
files.append(path + file)
|
||||||
|
print(files)
|
||||||
return files
|
return files
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue