От ОС зависит располодение папки с рабочими файлами

This commit is contained in:
Бородин Роман 2019-12-04 17:29:35 +03:00
parent 0e13795c4b
commit 84c821cc77
1 changed files with 7 additions and 2 deletions

View File

@ -1,9 +1,14 @@
import os import os
from peewee import Model, CharField, DateTimeField, TextField, ForeignKeyField, DateField, fn from peewee import Model, CharField, DateTimeField, TextField, ForeignKeyField, DateField, fn
from playhouse.sqlite_ext import CSqliteExtDatabase, FTS5Model, AutoIncrementField, SearchField, RowIDField, JSONField from playhouse.sqlite_ext import CSqliteExtDatabase, FTS5Model, AutoIncrementField, SearchField, RowIDField, JSONField
import re import platform
var_dir = os.path.join(os.path.abspath(os.environ['HOME']), '.eldoc') if 'windows' in platform.system().lower():
user_dir = os.path.abspath(os.environ['APPDATA'])
else:
user_dir = os.path.abspath(os.environ['HOME'])
var_dir = os.path.join(user_dir, '.eldoc')
db_dir = os.path.join(var_dir, 'db') db_dir = os.path.join(var_dir, 'db')
db_file = os.path.join(db_dir, 'eldoc.sqlite3') db_file = os.path.join(db_dir, 'eldoc.sqlite3')