From 9e86813243a7f449b15fc61188b2f8373214a4c4 Mon Sep 17 00:00:00 2001 From: Vic Wong Date: Sat, 4 Jan 2025 16:43:29 -0800 Subject: [PATCH] fix: tmp directory is not writeable in android #549 --- pikaraoke/lib/file_resolver.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pikaraoke/lib/file_resolver.py b/pikaraoke/lib/file_resolver.py index fe8e79e7..e28ff01d 100644 --- a/pikaraoke/lib/file_resolver.py +++ b/pikaraoke/lib/file_resolver.py @@ -1,6 +1,7 @@ import os import re import shutil +import tempfile import zipfile from sys import maxsize @@ -11,10 +12,8 @@ def get_tmp_dir(): # Determine tmp directories (for things like extracted cdg files) pid = os.getpid() # for scoping tmp directories to this process - if get_platform() == "windows": - tmp_dir = os.path.expanduser(r"~\\AppData\\Local\\Temp\\pikaraoke\\" + str(pid) + r"\\") - else: - tmp_dir = f"/tmp/pikaraoke/{pid}" + print(tempfile.gettempdir()) + tmp_dir = os.path.join(tempfile.gettempdir(), f"{pid}") return tmp_dir