Skip to content

Commit b4284ae

Browse files
committed
feat(jnml): install in standard dirs
1 parent 2a23166 commit b4284ae

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

omv/engines/getjnml.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
import os
2+
import platform
23
from subprocess import check_output
4+
from pathlib import Path
35

46
from omv.engines.utils.wdir import working_dir
57

8+
69
def install_jnml():
710

811
version='v0.12.2'
912

10-
jnmlpath = os.path.join(os.environ['HOME'],'jnml')
13+
try:
14+
jnmlhome = os.environ['JNML_HOME']
15+
jnmlpath = Path(jnmlhome).parent
16+
except KeyError:
17+
osname = platform.system()
18+
if osname == "Linux":
19+
try:
20+
jnmlpath = os.path.join(os.environ['XDG_DATA_HOME'],'jnml')
21+
except KeyError:
22+
jnmlpath = os.path.join(os.environ['HOME'],'.local/share/jnml')
23+
elif osname == "Darwin":
24+
jnmlpath = os.path.join(os.environ['HOME'],'Library/jnml')
25+
else:
26+
jnmlpath = os.path.join(os.environ['HOME'],'jnml')
27+
1128
if not os.path.isdir(jnmlpath):
1229
os.mkdir(jnmlpath)
1330
with working_dir(jnmlpath):

0 commit comments

Comments
 (0)