maybe this
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Torma Kristóf 2021-04-29 17:18:41 +02:00
parent 37d2e06a18
commit 3bcb7e18ce
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -34,7 +34,7 @@ class Executor:
def setCurrentDirectory(self, dirName: str) -> str: def setCurrentDirectory(self, dirName: str) -> str:
if dirName == "..": if dirName == "..":
if self.currentDirectory == self.baseDir: if self.currentDirectory == "":
return self.currentDirectory return self.currentDirectory
else: else:
directories = self.currentDirectory.split(os.path.sep) directories = self.currentDirectory.split(os.path.sep)
@ -42,13 +42,13 @@ class Executor:
for dir in directories: for dir in directories:
strdirectory += dir + os.path.sep strdirectory += dir + os.path.sep
strdirectory = strdirectory[:-3] strdirectory = strdirectory[:-3]
if os.path.exists(strdirectory): if os.path.exists(os.path.join(self.baseDir, self.currentDirectory)):
self.currentDirectory = strdirectory self.currentDirectory = strdirectory
return self.currentDirectory return self.currentDirectory
else: else:
dirName = self.sanitizeDirectory(dirName) dirName = self.sanitizeDirectory(dirName)
joinedDir = os.path.join(self.baseDir, self.currentDirectory, dirName) joinedDir = os.path.join(self.currentDirectory, dirName)
if os.path.exists(joinedDir): if os.path.join(self.baseDir, joinedDir):
self.currentDirectory = joinedDir self.currentDirectory = joinedDir
return self.currentDirectory return self.currentDirectory