From 58f66e0f427bd9d204de27cff92acd13ff016e44 Mon Sep 17 00:00:00 2001 From: black-sliver <59490463+black-sliver@users.noreply.github.com> Date: Sun, 18 Sep 2022 13:02:05 +0200 Subject: [PATCH] autoworld: don't load files/folders starting with '.' (#1030) * autoworld: don't load files/folders starting with '.' The imports fail if the folder has a '.' in the name, with a somewhat obscure error, and adding a '.' in front of it is what a linux user might expect to use when disabling a world temporarily. * autoworld: use tuple to filter .* and _* --- worlds/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worlds/__init__.py b/worlds/__init__.py index 46b383b3..e36eb275 100644 --- a/worlds/__init__.py +++ b/worlds/__init__.py @@ -27,7 +27,8 @@ class WorldSource(typing.NamedTuple): world_sources: typing.List[WorldSource] = [] file: os.DirEntry # for me (Berserker) at least, PyCharm doesn't seem to infer the type correctly for file in os.scandir(folder): - if not file.name.startswith("_"): # prevent explicitly loading __pycache__ and allow _* names for non-world folders + # prevent loading of __pycache__ and allow _* for non-world folders, disable files/folders starting with "." + if not file.name.startswith(("_", ".")): if file.is_dir(): world_sources.append(WorldSource(file.name)) elif file.is_file() and file.name.endswith(".apworld"):