Pulse Works Studio

Parse Error: Identifier "Directory" not declared in the current scope. Did you mean to use "DirAccess"?

Directory is gone. Godot 4 opens folders with DirAccess static methods.

Cause

Godot 3 used a Directory object you had to new() and open(). Godot 4 replaced it with DirAccess, and the rename hint points at that class. File paths still start with res:// or user://.

Fix

func list_scenes() -> PackedStringArray:
	var found: PackedStringArray = []
	var folder := DirAccess.open("res://scenes")
	if folder == null:
		return found
	for file_name in folder.get_files():
		if file_name.ends_with(".tscn"):
			found.append("res://scenes/%s" % file_name)
	return found

Related

Godot Dev Tools is a Pulse Works Studio project. All error explainers.