diff --git a/server/executor.py b/server/executor.py index 2e131a1..b4cf3a6 100644 --- a/server/executor.py +++ b/server/executor.py @@ -2,23 +2,13 @@ import os import re -import sys - class Executor: """This class executes commands recieved by the server""" - ABSOLUTE_PATH = os.path.abspath(os.path.dirname(sys.argv[0])) - BASE_PATH = ABSOLUTE_PATH + os.path.sep + 'home' + os.path.sep - DEFAULT_FOLDER = BASE_PATH + '0' - - def __init__(self, currentDiectory: str, baseDir: str = ""): - self.currentDirectory = currentDiectory - if baseDir == "": - self.baseDir = self.DEFAULT_FOLDER - else: - self.baseDir = self.BASE_PATH + baseDir + os.path.sep - + def __init__(self, baseDir: str): + self.currentDirectory = "" + self.baseDir = baseDir + os.path.sep def sanitizeDirectory(self, inDirectory: str) -> str: return re.sub('[^a-zA-Z0-9]', '', inDirectory) diff --git a/server/server.py b/server/server.py index 9a96435..ed34aa7 100644 --- a/server/server.py +++ b/server/server.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import os from authentication import Authetication from executor import Executor from netwrapper import NetWrapper @@ -21,7 +22,7 @@ class Server: def login(self, homeDir: str) -> None: self.isAuthenticated = True - self.executor = Executor("", homeDir) + self.executor = Executor(homeDir + os.path.seb) def logout(self) -> None: self.networkInstance.logout()