From 9d70a5f3c8d59acfa4063ca5f48ae48eead6a78d Mon Sep 17 00:00:00 2001 From: George Bryant Date: Wed, 4 Dec 2013 15:44:07 +0000 Subject: [PATCH] Modified save and open behaviour so that opening rewrites will work if file had a non-4-char extension --- notevelocity/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/notevelocity/main.py b/notevelocity/main.py index 533d1dc..ff217cd 100644 --- a/notevelocity/main.py +++ b/notevelocity/main.py @@ -263,8 +263,8 @@ def saveFile(self, mode): else: return 1 else: - saveLocation = self.textFrame.fileName[:-4] + "rewrite" - + fileNameMinusNote = self.textFrame.fileName.split(".")[:-1] + saveLocation = ".".join(fileNameMinusNote) + ".rewrite" fileToSave = open(saveLocation, "w+") textContents = self.textFrame.rewriteBox.get("1.0", "end") @@ -321,7 +321,8 @@ def openFile(self): print("Opened file from " + openLocation) self.log.write("Opened file from " + openLocation) - rewriteLocation = openLocation[:-4] + "rewrite" + fileNameMinusNote = openLocation.split(".")[:-1] + rewriteLocation = ".".join(fileNameMinusNote) + ".rewrite" if path.isfile(rewriteLocation): rewriteFile = open(rewriteLocation, "r")