diff --git a/src/LuaEngine/docs/ElunaDoc/__main__.py b/src/LuaEngine/docs/ElunaDoc/__main__.py index 75ce746..d8bf99f 100644 --- a/src/LuaEngine/docs/ElunaDoc/__main__.py +++ b/src/LuaEngine/docs/ElunaDoc/__main__.py @@ -16,15 +16,10 @@ def find_class_files(search_path): :param search_path: the path to search for Eluna methods in :return: a list of all files containing Eluna methods, and the name of their respective classes """ - # Get the current working dir and switch to the search path. - old_dir = os.getcwd() - os.chdir(search_path) # Search for all files ending in "Methods.h". - method_file_names = glob.glob('*Methods.h') + method_file_names = glob.glob(os.path.join(search_path, '**', '*Methods.h')) # Open each file. method_files = [open(file_name, 'r') for file_name in method_file_names] - # Go back to where we were before. - os.chdir(old_dir) return method_files diff --git a/src/LuaEngine/docs/ElunaDoc/parser.py b/src/LuaEngine/docs/ElunaDoc/parser.py index 471c87f..0a0f115 100644 --- a/src/LuaEngine/docs/ElunaDoc/parser.py +++ b/src/LuaEngine/docs/ElunaDoc/parser.py @@ -1,3 +1,4 @@ +import os import re import typing import markdown @@ -321,7 +322,7 @@ class ClassParser(object): def parse_file(file): """Parse the file `file` into a documented class.""" # Get the class name from "ClassMethods.h" by stripping off "Methods.h". - class_name = file.name[:-len('Methods.h')] + class_name = os.path.basename(file.name)[:-len('Methods.h')] parser = ClassParser(class_name) line = file.readline()