comparison libervia/backend/core/constants.py @ 4171:da7d360a87be

core (constants): user platform temporary dir by default for PID files
author Goffi <goffi@goffi.org>
date Mon, 04 Dec 2023 17:51:28 +0100
parents a1f7040b5a15
children 50c919dfe61b
comparison
equal deleted inserted replaced
4170:b47f21f2b8fa 4171:da7d360a87be
20 from xdg import BaseDirectory 20 from xdg import BaseDirectory
21 from os.path import expanduser, realpath 21 from os.path import expanduser, realpath
22 except ImportError: 22 except ImportError:
23 BaseDirectory = None 23 BaseDirectory = None
24 from os.path import dirname 24 from os.path import dirname
25 import tempfile
25 from typing import Final 26 from typing import Final
27
26 from libervia import backend 28 from libervia import backend
27 29
28 30
29 class Const(object): 31 class Const(object):
30 32
480 Environment.getExternalStoragePublicDirectory( 482 Environment.getExternalStoragePublicDirectory(
481 Environment.DIRECTORY_DOWNLOADS 483 Environment.DIRECTORY_DOWNLOADS
482 ).getAbsolutePath(), 484 ).getAbsolutePath(),
483 Const.APP_NAME_FILE, 485 Const.APP_NAME_FILE,
484 ), 486 ),
485 "pid_dir": "%(local_dir)s", 487 "pid_dir": tempfile.gettempdir(),
486 "log_dir": "%(local_dir)s", 488 "log_dir": "%(local_dir)s",
487 } 489 }
488 Const.CONFIG_FILES = [ 490 Const.CONFIG_FILES = [
489 "/data/data/org.libervia.cagou/files/app/android/" 491 "/data/data/org.libervia.cagou/files/app/android/"
490 + Const.APP_NAME_FILE 492 + Const.APP_NAME_FILE
523 ## Configuration ## 525 ## Configuration ##
524 Const.DEFAULT_CONFIG = { 526 Const.DEFAULT_CONFIG = {
525 "media_dir": "/usr/share/" + Const.APP_NAME_FILE + "/media", 527 "media_dir": "/usr/share/" + Const.APP_NAME_FILE + "/media",
526 "local_dir": BaseDirectory.save_data_path(Const.APP_NAME_FILE), 528 "local_dir": BaseDirectory.save_data_path(Const.APP_NAME_FILE),
527 "downloads_dir": "~/Downloads/" + Const.APP_NAME_FILE, 529 "downloads_dir": "~/Downloads/" + Const.APP_NAME_FILE,
528 "pid_dir": "%(local_dir)s", 530 "pid_dir": tempfile.gettempdir(),
529 "log_dir": "%(local_dir)s", 531 "log_dir": "%(local_dir)s",
530 } 532 }
531 533
532 # List of the configuration filenames sorted by ascending priority 534 # List of the configuration filenames sorted by ascending priority
533 Const.CONFIG_FILES = [ 535 Const.CONFIG_FILES = [