From 33f28268cdec1d3b5efc2573b79942dc8460194f Mon Sep 17 00:00:00 2001 From: Ategon Date: Tue, 27 Aug 2024 18:55:22 -0400 Subject: [PATCH] Remove file names automatically from autoloads --- tracks/base.gd | 4 ++-- tracks/exampleautoload.gd | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tracks/base.gd b/tracks/base.gd index 37eee4f..979cd9e 100644 --- a/tracks/base.gd +++ b/tracks/base.gd @@ -20,10 +20,10 @@ func get_tracks(): while file_name != "": if not dir.current_is_dir() and not file_name.ends_with(".import"): + var track_name = file_name.rsplit(".", true, 1)[0] var regex = RegEx.new() regex.compile(_autoload.pattern) - var result = regex.search(file_name) - var track_name = file_name + var result = regex.search(track_name) if result: track_name = result.get_string() diff --git a/tracks/exampleautoload.gd b/tracks/exampleautoload.gd index ea10cbc..2c6d33c 100644 --- a/tracks/exampleautoload.gd +++ b/tracks/exampleautoload.gd @@ -15,7 +15,7 @@ func _init(): _autoload = { "path": "res://music/example", - "pattern": "^[^.]+" + "pattern": ".*" } # You can still override things using a _tracks variable and the track set to the path to the file for what you want to override