commit cd4a53ff221a5c3214f8346ff35e1bcd07703581
parent 99e023e2eb9e74bde473368d26c03c2599a07faf
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date: Thu, 16 Apr 2020 08:23:17 -0700
Improve overwrite confirmation.
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Songs2Slides.py b/Songs2Slides.py
@@ -169,7 +169,6 @@ if (__name__ == "__main__"):
# Get filepath
filepath = input("Please enter a filepath to save your powerpoint to: ")
- openFirst = (input("Would you like to add on to the powerpoint if it already exists? (y/n): ").lower() == "y")
# Add extension
if (len(filepath) == 0):
@@ -181,6 +180,12 @@ if (__name__ == "__main__"):
elif (len(filepath) > 4 and filepath[-5:] != ".pptx" and filepath[-4:] != ".ppt"):
filepath += ".pptx"
+ # Confirm overwrite
+ if (os.path.exists(filepath)):
+ openFirst = (input("Would you like to add on to the existing powerpoint? (y/n): ").lower() == "y")
+ else:
+ openFirst = False
+
# Create powerpoint
try:
CreatePptx(lyrics, filepath, openFirst, settings)