Minor tweak in file format

This commit is contained in:
Olivier Keshavjee 2016-03-31 10:45:58 +02:00
parent 574660dc19
commit cf6e021ed1
3 changed files with 10 additions and 8 deletions

View file

@ -39,10 +39,16 @@ def loadProject(project):
isZip = False
# Does it have a VERSION in zip root?
# Was used in transition between 0.2.0 and 0.3.0
# So VERSION part can be deleted for manuskript 0.4.0
if isZip and "VERSION" in zf.namelist():
version = int(zf.read("VERSION"))
# Zip but no VERSION: oldest file format
# Does it have a MANUSKRIPT in zip root?
elif isZip and "MANUSKRIPT" in zf.namelist():
version = int(zf.read("MANUSKRIPT"))
# Zip but no VERSION/MANUSKRIPT: oldest file format
elif isZip:
version = 0

View file

@ -118,9 +118,8 @@ def saveProject(zip=None):
mw = mainWindow()
if zip:
# File format version
files.append(("VERSION", "1"))
# File format version
files.append(("MANUSKRIPT", "1"))
# General infos (book and author)
# Saved in plain text, in infos.txt
@ -378,10 +377,6 @@ def saveProject(zip=None):
if os.path.isdir(filename):
shutil.rmtree(filename)
elif path == "VERSION":
# If loading from zip, but saving to path, file VERSION is not needed.
continue
else: # elif os.path.exists(filename)
os.remove(filename)

View file

@ -0,0 +1 @@
1