Skip to content

Commit

Permalink
Fixed New File and Terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnrpaul committed Oct 20, 2023
1 parent deba3fc commit 187432d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion cipher/src/filemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, ""
)
Expand Down Expand Up @@ -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():
Expand Down
4 changes: 2 additions & 2 deletions cipher/src/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 187432d

Please sign in to comment.