finito execturo for real
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2021-04-18 15:54:13 +02:00
parent b8828d52b4
commit 89b7b68dfe
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -36,10 +36,21 @@ class Executor:
return self.currentDirectory
def setCurrentDirectory(self, dirName: str) -> str:
# TODO : Navigate up a directory structure
dirName = self.sanitizeDirectory(dirName)
self.currentDirectory = self.currentDirectory + "/" + dirName
return self.currentDirectory
if dirName == "..":
if self.currentDirectory == self.baseDir:
return self.currentDirectory
else:
directories = self.currentDirectory.split("/")
strdirectory = ""
for dir in directories:
strdirectory += dir + "/"
strdirectory = strdirectory[:-3]
self.currentDirectory = strdirectory
return self.currentDirectory
else:
dirName = self.sanitizeDirectory(dirName)
self.currentDirectory = self.currentDirectory + "/" + dirName
return self.currentDirectory
def listCurrentDirectoryContent(self) -> str:
contents = os.listdir(self.currentDirectory)
@ -52,10 +63,10 @@ class Executor:
def putFileInCurrentDirectory(self, filename: str, content) -> str:
filename = self.sanitizeFile(filename)
currenctfile = self.currentDirectory + "/" + filename
f = open(currenctfile,"wb")
f = open(currenctfile, "wb")
f.write(content)
f.close()
return currenctfile
return currenctfile
def getFileInCurrentDirectory(self, file: str):
file = self.sanitizeFile(file)