mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 01:54:49 +00:00
configd / configuration templates - add helpers.file_exists to check for file existence. closes https://github.com/opnsense/core/issues/7023
This commit is contained in:
parent
eb74bd05ff
commit
e76bc6ead8
@ -175,6 +175,18 @@ class Helpers(object):
|
||||
return [lst]
|
||||
return lst
|
||||
|
||||
@staticmethod
|
||||
def file_exists(pathname):
|
||||
"""
|
||||
:param pathname: absolute or relative path name depending if it starts with a /
|
||||
:return: bool
|
||||
"""
|
||||
if pathname.startswith('/'):
|
||||
return os.path.isfile(pathname)
|
||||
else:
|
||||
template_path = os.path.realpath("%s/../../templates/" % os.path.dirname(__file__))
|
||||
return os.path.isfile("%s/%s" % (template_path, pathname))
|
||||
|
||||
@staticmethod
|
||||
def glob(pathname):
|
||||
"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user