From 187432d827521d9503aef8101e2d12c2282ca0a0 Mon Sep 17 00:00:00 2001 From: Srpboyz Date: Thu, 19 Oct 2023 17:12:42 -0700 Subject: [PATCH] Fixed New File and Terminal --- cipher/src/filemanager.py | 7 ++++++- cipher/src/terminal.py | 4 ++-- pyproject.toml | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cipher/src/filemanager.py b/cipher/src/filemanager.py index 5e817c0..08197a0 100644 --- a/cipher/src/filemanager.py +++ b/cipher/src/filemanager.py @@ -238,6 +238,8 @@ def createFile(self) -> None: index = index[0] else: index = self.getIndex() + if Path(self.filePath(index)).is_file(): + index = index.parent() name, ok = QInputDialog.getText( self, "File Name", "Give a name", QLineEdit.EchoMode.Normal, "" ) @@ -575,7 +577,10 @@ def getWorkspaceSettings(self) -> Dict[str, Union[str, Any]]: if sys.platform == "win32": win32api.SetFileAttributes(str(path), win32con.FILE_ATTRIBUTE_HIDDEN) with open(f"{path}/run.bat", "w") as f: - f.write("@echo off\n") + f.write("@echo off\nEXIT") + else: + with open(f"{path}/run.sh", "w") as f: + f.write("") path = Path(f"{path}/settings.json").absolute() if not path.exists(): diff --git a/cipher/src/terminal.py b/cipher/src/terminal.py index 4ac03b4..91becf6 100644 --- a/cipher/src/terminal.py +++ b/cipher/src/terminal.py @@ -159,14 +159,14 @@ def run(self) -> None: if not self._window.currentFolder or self.isRunning(): return if sys.platform == "win32": - program, args = ".cipher\\run.bat", [] + program, args = "powershell", [".cipher\\run.bat"] elif sys.platform == "linux": program, args = "bash", [".cipher/run.sh"] output = f"{program} {' '.join(args)}" self.stdout.setPlainText(f"{self.stdout.toPlainText()}{output}\n") self.stdin.prevCommands.append(f"{output}") self.stdin.index = len(self.stdin.prevCommands) - self._run(program, args, str(self._window.currentFolder)) + self._run(program, args, str(self.currentDirectory)) def runProcess(self, text: str) -> None: if self.isRunning(): diff --git a/pyproject.toml b/pyproject.toml index 055cc62..febef2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cipher" -version = "1.4.0" +version = "1.3.1" description = "A text editor made using PyQt6" authors = ["Srpboyz "] readme = "README.md"