finito execturo for real
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b8828d52b4
commit
89b7b68dfe
@ -36,10 +36,21 @@ class Executor:
|
|||||||
return self.currentDirectory
|
return self.currentDirectory
|
||||||
|
|
||||||
def setCurrentDirectory(self, dirName: str) -> str:
|
def setCurrentDirectory(self, dirName: str) -> str:
|
||||||
# TODO : Navigate up a directory structure
|
if dirName == "..":
|
||||||
dirName = self.sanitizeDirectory(dirName)
|
if self.currentDirectory == self.baseDir:
|
||||||
self.currentDirectory = self.currentDirectory + "/" + dirName
|
return self.currentDirectory
|
||||||
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:
|
def listCurrentDirectoryContent(self) -> str:
|
||||||
contents = os.listdir(self.currentDirectory)
|
contents = os.listdir(self.currentDirectory)
|
||||||
@ -52,10 +63,10 @@ class Executor:
|
|||||||
def putFileInCurrentDirectory(self, filename: str, content) -> str:
|
def putFileInCurrentDirectory(self, filename: str, content) -> str:
|
||||||
filename = self.sanitizeFile(filename)
|
filename = self.sanitizeFile(filename)
|
||||||
currenctfile = self.currentDirectory + "/" + filename
|
currenctfile = self.currentDirectory + "/" + filename
|
||||||
f = open(currenctfile,"wb")
|
f = open(currenctfile, "wb")
|
||||||
f.write(content)
|
f.write(content)
|
||||||
f.close()
|
f.close()
|
||||||
return currenctfile
|
return currenctfile
|
||||||
|
|
||||||
def getFileInCurrentDirectory(self, file: str):
|
def getFileInCurrentDirectory(self, file: str):
|
||||||
file = self.sanitizeFile(file)
|
file = self.sanitizeFile(file)
|
||||||
|
Loading…
Reference in New Issue
Block a user