mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Append to subdir function for windows mapping
This commit is contained in:
parent
3a763178d7
commit
aaefcb913b
@ -435,12 +435,20 @@ class Helpers:
|
||||
|
||||
return data
|
||||
|
||||
@staticmethod
|
||||
def is_subdir(server_path, root_dir):
|
||||
def is_subdir(self, server_path, root_dir):
|
||||
server_path = os.path.realpath(server_path)
|
||||
root_dir = os.path.realpath(root_dir)
|
||||
|
||||
relative = os.path.relpath(server_path, root_dir)
|
||||
if self.is_os_windows():
|
||||
try:
|
||||
relative = os.path.relpath(server_path, root_dir)
|
||||
except:
|
||||
# Windows will crash out if two paths are on different
|
||||
# Drives We can happily return false if this is the case.
|
||||
# Since two different drives will not be relative to eachother.
|
||||
return False
|
||||
else:
|
||||
relative = os.path.relpath(server_path, root_dir)
|
||||
|
||||
if relative.startswith(os.pardir):
|
||||
return False
|
||||
@ -887,12 +895,15 @@ class Helpers:
|
||||
try:
|
||||
os.makedirs(path)
|
||||
logger.debug(f"Created Directory : {path}")
|
||||
return True
|
||||
|
||||
# directory already exists - non-blocking error
|
||||
except FileExistsError:
|
||||
pass
|
||||
return True
|
||||
except PermissionError as e:
|
||||
logger.critical(f"Check generated exception due to permssion error: {e}")
|
||||
return False
|
||||
|
||||
def create_self_signed_cert(self, cert_dir=None):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user