Added persistent user data and installer generator for windows.
This commit is contained in:
parent
57a2a2f3a0
commit
a6f8ab247c
5 changed files with 202 additions and 21 deletions
14
utils.py
14
utils.py
|
|
@ -2,6 +2,7 @@ from __future__ import print_function
|
|||
import os, zipfile, io, platform
|
||||
import sys, tempfile
|
||||
import subprocess
|
||||
from appdirs import AppDirs
|
||||
|
||||
#try:
|
||||
# import zlib
|
||||
|
|
@ -17,6 +18,19 @@ def is_windows():
|
|||
def get_temp_dir():
|
||||
return tempfile.gettempdir()
|
||||
|
||||
def get_data_path(dir_path):
|
||||
parts = dir_path.split('/')
|
||||
dirs = AppDirs('Web2Executable', 'Web2Executable')
|
||||
data_path = os.path.join(dirs.user_data_dir, *parts)
|
||||
if not os.path.exists(data_path):
|
||||
os.makedirs(data_path)
|
||||
return data_path
|
||||
|
||||
def get_data_file_path(file_path):
|
||||
parts = file_path.split('/')
|
||||
data_path = get_data_path('/'.join(parts[:-1]))
|
||||
return os.path.join(data_path, parts[-1])
|
||||
|
||||
def log(*args):
|
||||
if DEBUG:
|
||||
print(*args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue