This commit is contained in:
parent
37d2e06a18
commit
3bcb7e18ce
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user