fix: is_dir() not is_dir

This commit is contained in:
shenjack-mac 2023-04-22 22:00:51 +08:00
parent 625f4cacfd
commit af2c312d10
3 changed files with 5 additions and 5 deletions

View File

@ -160,7 +160,7 @@ class _DR_runtime(Options):
sys.path.append(self.mod_path)
for mod_path in paths:
try:
if mod_path.is_dir: # 处理文件夹 mod
if mod_path.is_dir() and mod_path.name != '__pycache__': # 处理文件夹 mod
if importlib.util.find_spec(mod_path.name) is not None:
module = importlib.import_module(mod_path.name)
mods.append(mod_path.name)
@ -171,6 +171,7 @@ class _DR_runtime(Options):
module = importlib.import_module(mod_path.name)
mods.append(mod_path.name)
elif mod_path.suffix == '.py': # 处理单文件 mod
print(f'importing mod {mod_path=} {mod_path.stem}')
module = importlib.import_module(mod_path.stem)
mods.append(mod_path.stem)
except ImportError:

View File

@ -7,8 +7,8 @@ fonts_folder = "libs/fonts"
[window]
style = "None"
width = 1406
height = 900
width = 958
height = 587
visible = true
gui_scale = 1
caption = "Difficult Rocket v{DR_version}|DR_rs v{DR_Rust_get_version}"
@ -19,6 +19,5 @@ full_screen = false
width = 1024
height = 768
gui_scale = 1
[game.mods]
path = "mods"

View File

@ -5,7 +5,7 @@
# -------------------------------
from MCDR.version import Version
from Difficult_Rocket.mod import ModInfo
from Difficult_Rocket.api.mod import ModInfo
INFO = ModInfo(
mod_id="Difficult_Rocket_mod",