fix loading ink.csv from XDG storage
This commit is contained in:
parent
4d919c9746
commit
3a1ab2be66
4 changed files with 16 additions and 6 deletions
|
|
@ -33,8 +33,13 @@ class Pen:
|
|||
class InkTracker:
|
||||
def __init__(self, storage_file: str = None):
|
||||
if storage_file is None:
|
||||
storage_file = os.path.abspath('inks.csv')
|
||||
self.storage_file = os.path.abspath(storage_file)
|
||||
storage_file = os.getenv('INK_TRACKER_CSV')
|
||||
if storage_file is None:
|
||||
data_home = os.getenv('XDG_DATA_HOME', os.path.expanduser('~/.local/share'))
|
||||
app_data_dir = os.path.join(data_home, 'pen-tracker')
|
||||
os.makedirs(app_data_dir, exist_ok=True)
|
||||
storage_file = os.path.join(app_data_dir, 'inks.csv')
|
||||
self.storage_file = storage_file
|
||||
self.headers = ['Vendor', 'Name', 'Color', 'Purchased', 'Size', 'Notes']
|
||||
self.inks: List[Ink] = self.load_data()
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||
|
||||
[project]
|
||||
name = "pen-tracker"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
authors = [
|
||||
{ name="Don Harper", email="don@donharper.org" },
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Metadata-Version: 2.4
|
||||
Name: pen-tracker
|
||||
Version: 0.4.0
|
||||
Version: 0.4.1
|
||||
Summary: A fountain pen collection tracker.
|
||||
Author-email: Don Harper <don@donharper.org>
|
||||
Requires-Python: >=3.8
|
||||
|
|
|
|||
|
|
@ -33,8 +33,13 @@ class Pen:
|
|||
class InkTracker:
|
||||
def __init__(self, storage_file: str = None):
|
||||
if storage_file is None:
|
||||
storage_file = os.path.abspath('inks.csv')
|
||||
self.storage_file = os.path.abspath(storage_file)
|
||||
storage_file = os.getenv('INK_TRACKER_CSV')
|
||||
if storage_file is None:
|
||||
data_home = os.getenv('XDG_DATA_HOME', os.path.expanduser('~/.local/share'))
|
||||
app_data_dir = os.path.join(data_home, 'pen-tracker')
|
||||
os.makedirs(app_data_dir, exist_ok=True)
|
||||
storage_file = os.path.join(app_data_dir, 'inks.csv')
|
||||
self.storage_file = storage_file
|
||||
self.headers = ['Vendor', 'Name', 'Color', 'Purchased', 'Size', 'Notes']
|
||||
self.inks: List[Ink] = self.load_data()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue