Skip to content

Commit

Permalink
Fix history first boot, and fix picow extras
Browse files Browse the repository at this point in the history
  • Loading branch information
bill88t committed Jan 3, 2024
1 parent 98f79f5 commit 98e6381
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions source/ljinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,24 +842,26 @@ class history:
historyy = []
nav = [0, 0, ""]
sz = 50
modified = False

def load(filen: str) -> None:
ljinux.history.historyy = []
try:
with ljinux.api.fopen(filen, "r") as historyfile:
with ljinux.api.fopen(filen, "r") as historyfile:
if historyfile is not None:
for line in historyfile:
ljinux.io.ledset(3) # act
ljinux.history.historyy.append(line.strip())
ljinux.io.ledset(1) # idle
except OSError:
try:
with ljinux.api.fopen(filen, "w") as historyfile:
pass
except RuntimeError:
ljinux.based.error(4, filen)
ljinux.io.ledset(1) # idle
else:
try:
with ljinux.api.fopen(filen, "w") as historyfile:
pass
except RuntimeError:
ljinux.based.error(4, filen)
ljinux.io.ledset(1) # idle

def appen(itemm: str) -> None: # add to history, but don't save to file
ljinux.history.modified = True
if (
len(ljinux.history.historyy) > 0 and itemm != ljinux.history.gett(1)
) or len(ljinux.history.historyy) is 0:
Expand All @@ -879,6 +881,8 @@ def shift(itemm: str) -> None:
ljinux.history.historyy.append(itemm)

def save(filen: str) -> None:
if not ljinux.history.modified:
return
try:
with ljinux.api.fopen(filen, "w") as historyfile:
if historyfile is None:
Expand Down

0 comments on commit 98e6381

Please sign in to comment.