This commit is contained in:
parent
00d4542404
commit
152177473d
@ -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)
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user