this is the DecksList, i want the buttons to be named as the subdirectory folders like
Button1 = Base Cards
Button2 = Booster Pack 1
etc...
This is the output i get when i "print(DecksList)"
var DecksList = [res://cards/., res://cards/.., res://cards/Base Cards, res://cards/Booster Pack 1, res://cards/Booster Pack 2, res://cards/Max Basic Pack, res://cards/Max Booster Pack 1, res://cards/Max Booster Pack 2, res://cards/Max Magic, res://cards/Optimized Cards (Hard)]
also i have noticed a problem just right now that i have 2 "res://cards/." in the array.
i'm using this code to generate it and i assume those 2 will interfere with what i'm trying to do, so how do i remove those, i don't even know why they are generated.
var numCards = 0
var dir = Directory.new()
var DecksList = Array()
var CardsPath = "res://cards/"
func _ready():
if dir.open(CardsPath) == OK:
dir.list_dir_begin()
var file_name = dir.get_next()
while (file_name != ""):
if file_name.ends_with(".import"):
pass
else:
DecksList.push_back((CardsPath)+file_name)
if dir.current_is_dir():
numCards += 1
file_name = dir.get_next()
print(DecksList)