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
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user