From b8828d52b4c7eabb2c0240334d8efb4135fb6655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sun, 18 Apr 2021 15:34:00 +0200 Subject: [PATCH] executor almost finito --- server/executor.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/server/executor.py b/server/executor.py index 3050f87..2da0185 100644 --- a/server/executor.py +++ b/server/executor.py @@ -50,15 +50,20 @@ class Executor: return strdirectory def putFileInCurrentDirectory(self, filename: str, content) -> str: - pass + filename = self.sanitizeFile(filename) + currenctfile = self.currentDirectory + "/" + filename + f = open(currenctfile,"wb") + f.write(content) + f.close() + return currenctfile def getFileInCurrentDirectory(self, file: str): file = self.sanitizeFile(file) - currentfile = self.currentDirectory + file + currentfile = self.currentDirectory + "/" + file return open(currentfile, "r") def removeFileInCurrentDirectory(self, file: str) -> str: file = self.sanitizeFile(file) - currentfile = self.currentDirectory + file + currentfile = self.currentDirectory + "/" + file os.remove(currentfile) return currentfile