From 6dc735c18041a70a42214bda23f5f876599a92a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sun, 18 Apr 2021 16:18:44 +0200 Subject: [PATCH] use os independent path --- server/executor.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/executor.py b/server/executor.py index e0340e5..4620657 100644 --- a/server/executor.py +++ b/server/executor.py @@ -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