better things
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Torma Kristóf 2021-04-29 17:00:50 +02:00
parent 00d4542404
commit 152177473d
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047
2 changed files with 5 additions and 14 deletions

View File

@ -2,23 +2,13 @@
import os import os
import re import re
import sys
class Executor: class Executor:
"""This class executes commands recieved by the server""" """This class executes commands recieved by the server"""
ABSOLUTE_PATH = os.path.abspath(os.path.dirname(sys.argv[0])) def __init__(self, baseDir: str):
BASE_PATH = ABSOLUTE_PATH + os.path.sep + 'home' + os.path.sep self.currentDirectory = ""
DEFAULT_FOLDER = BASE_PATH + '0' self.baseDir = baseDir + os.path.sep
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 sanitizeDirectory(self, inDirectory: str) -> str: def sanitizeDirectory(self, inDirectory: str) -> str:
return re.sub('[^a-zA-Z0-9]', '', inDirectory) return re.sub('[^a-zA-Z0-9]', '', inDirectory)

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os
from authentication import Authetication from authentication import Authetication
from executor import Executor from executor import Executor
from netwrapper import NetWrapper from netwrapper import NetWrapper
@ -21,7 +22,7 @@ class Server:
def login(self, homeDir: str) -> None: def login(self, homeDir: str) -> None:
self.isAuthenticated = True self.isAuthenticated = True
self.executor = Executor("", homeDir) self.executor = Executor(homeDir + os.path.seb)
def logout(self) -> None: def logout(self) -> None:
self.networkInstance.logout() self.networkInstance.logout()