avoid exceptions when the user's config points to nonexistent directories
This commit is contained in:
parent
e959d11cd0
commit
17f99805f0
@ -46,10 +46,13 @@ def get_server_name(config, fname):
|
||||
path = path.replace('\\', '/')
|
||||
if path.endswith('/*'):
|
||||
path = path[:-2]
|
||||
try:
|
||||
for dirent in os.listdir(path):
|
||||
query_path = os.path.join(path, dirent)
|
||||
if os.path.isdir(query_path) and path_contains_file(query_path, fname):
|
||||
return name.replace('*', dirent)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
if path_contains_file(path, fname):
|
||||
return name.replace('*', os.path.basename(path))
|
||||
|
Loading…
x
Reference in New Issue
Block a user