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('\\', '/')
|
path = path.replace('\\', '/')
|
||||||
if path.endswith('/*'):
|
if path.endswith('/*'):
|
||||||
path = path[:-2]
|
path = path[:-2]
|
||||||
|
try:
|
||||||
for dirent in os.listdir(path):
|
for dirent in os.listdir(path):
|
||||||
query_path = os.path.join(path, dirent)
|
query_path = os.path.join(path, dirent)
|
||||||
if os.path.isdir(query_path) and path_contains_file(query_path, fname):
|
if os.path.isdir(query_path) and path_contains_file(query_path, fname):
|
||||||
return name.replace('*', dirent)
|
return name.replace('*', dirent)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
if path_contains_file(path, fname):
|
if path_contains_file(path, fname):
|
||||||
return name.replace('*', os.path.basename(path))
|
return name.replace('*', os.path.basename(path))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user