feat(py): dedicated history folder

This commit is contained in:
quenousimporte 2023-09-21 10:23:15 +02:00
parent 0c7fa3d714
commit 8bf3a8a140
1 changed files with 3 additions and 1 deletions

View File

@ -48,7 +48,7 @@ def editnote(note):
newcontent = readtextfile("data/" + filename(note) )
if newcontent != content:
subprocess.call(["cp", "data/" + filename(note), "data/" + filename(note) + str(time.time())])
subprocess.call(["cp", "data/" + filename(note), "history/" + filename(note) + str(time.time())])
subprocess.call(settings["commands"]["diff"] + ["data/" + filename(note) + ".bak", "data/" + filename(note)])
note["content"] = newcontent
data.remove(note)
@ -88,6 +88,8 @@ def ask(question):
def initdatapath():
if not os.path.exists("data"):
os.mkdir("data")
if not os.path.exists("history"):
os.mkdir("history")
if os.path.isfile("data/data.acs.bak"):
os.remove("data/data.acs.bak")