mirror of
https://github.com/ammaraskar/pyCraft.git
synced 2024-11-16 07:15:24 +01:00
Slight simplification, non recursive plugin loading, only .py files in plugins folder are going to be loaded now and not in sub-directories
This commit is contained in:
parent
9f076a6f37
commit
6817988b3b
@ -12,11 +12,12 @@ class PluginLoader():
|
||||
|
||||
|
||||
def loadPlugins(self, parser):
|
||||
for root, dirs, files in os.walk(self.path):
|
||||
for source in (s for s in files if s.endswith(".py")):
|
||||
name = os.path.splitext(os.path.basename(source))[0]
|
||||
full_name = os.path.splitext(source)[0].replace(os.path.sep, '.')
|
||||
m = imp.load_module(full_name, *imp.find_module(name, [root]))
|
||||
for item in os.listdir(self.path):
|
||||
split = os.path.splitext(item)
|
||||
if (split[1] == '.py'):
|
||||
name = split[0]
|
||||
full_name = split[0].replace(os.path.sep, '.')
|
||||
m = imp.load_module(full_name, *imp.find_module(name, [self.path]))
|
||||
|
||||
pluginClass = None
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user