fix: create .osdk directory at first start

When launching osdk for the first time, the `.osdk` directory is not
present on the project directory. This fix create the directory if it's
not present.
This commit is contained in:
Jordan ⌨️ 2023-02-06 19:25:47 +01:00 committed by SMNX ⠵
parent 07a10f192d
commit 6c8fdb8521

View file

@ -1,6 +1,7 @@
import sys import sys
from osdk import const from os.path import isdir
from osdk import const, shell
from osdk.args import parse from osdk.args import parse
from osdk.cmds import exec, usage from osdk.cmds import exec, usage
from osdk.plugins import loadAll from osdk.plugins import loadAll
@ -11,6 +12,8 @@ def main() -> int:
a = parse(sys.argv[1:]) a = parse(sys.argv[1:])
if not a.consumeOpt("verbose", False): if not a.consumeOpt("verbose", False):
if not isdir(const.OSDK_DIR):
shell.mkdir(const.OSDK_DIR)
sys.stderr = open(f"{const.OSDK_DIR}/osdk.log", "w") sys.stderr = open(f"{const.OSDK_DIR}/osdk.log", "w")
try: try: