use os independent path
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2021-04-18 16:18:44 +02:00
parent d3e830c59a
commit 6dc735c180
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -22,13 +22,13 @@ class Executor:
def createDirectory(self, dirName: str) -> str:
dirName = self.sanitizeDirectory(dirName)
actualDirName = self.currentDirectory + "/" + dirName
actualDirName = os.path.join(self.currentDirectory, dirName)
os.mkdir(actualDirName)
return actualDirName
def removeDirectory(self, dirName: str) -> str:
dirName = self.sanitizeDirectory(dirName)
actualDirName = self.currentDirectory + "/" + dirName
actualDirName = os.path.join(self.currentDirectory, dirName)
os.rmdir(actualDirName)
return actualDirName
@ -49,7 +49,7 @@ class Executor:
return self.currentDirectory
else:
dirName = self.sanitizeDirectory(dirName)
self.currentDirectory = self.currentDirectory + "/" + dirName
self.currentDirectory = os.path.join(self.currentDirectory, dirName)
return self.currentDirectory
def listCurrentDirectoryContent(self) -> str:
@ -62,7 +62,7 @@ class Executor:
def putFileInCurrentDirectory(self, filename: str, content) -> str:
filename = self.sanitizeFile(filename)
currenctfile = self.currentDirectory + "/" + filename
currenctfile = os.path.join(self.currentDirectory, filename)
f = open(currenctfile, "wb")
f.write(content)
f.close()
@ -70,11 +70,11 @@ class Executor:
def getFileInCurrentDirectory(self, file: str):
file = self.sanitizeFile(file)
currentfile = self.currentDirectory + "/" + file
currentfile = os.path.join(self.currentDirectory, file)
return open(currentfile, "r")
def removeFileInCurrentDirectory(self, file: str) -> str:
file = self.sanitizeFile(file)
currentfile = self.currentDirectory + "/" + file
currentfile = os.path.join(self.currentDirectory, file)
os.remove(currentfile)
return currentfile