Skip to content

Commit 3601176

Browse files
authored
add termux support (#162)
* try add termux * fix * fix * fix * fix
1 parent 35a4524 commit 3601176

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pyaarlo/cfg.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import platform
22
import tempfile
3+
import os
34
from urllib.parse import urlparse
45

56
from .constant import (
@@ -36,8 +37,12 @@ def __init__(self, arlo, **kwargs):
3637
self._kw = kwargs
3738
self._arlo.debug("config: loaded")
3839
self._update_backend = False
39-
if platform.system() == "Windows":
40-
self._storage_dir = tempfile.gettempdir() + r"\.aarlo"
40+
strplatform = platform.system()
41+
termux_dir = "/data/data/com.termux/files/home"
42+
if strplatform == "Windows":
43+
self._storage_dir = os.path.join(tempfile.gettempdir(), ".aarlo")
44+
elif os.path.exists(termux_dir):
45+
self._storage_dir = self._kw.get("storage_dir", os.path.join(termux_dir, ".aarlo"))
4146
else:
4247
self._storage_dir = self._kw.get("storage_dir", "/tmp/.aarlo")
4348

0 commit comments

Comments
 (0)