Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use XDG_STATE_HOME for jackdbus logs #967

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions dbus/jackdbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ pathname_cat(const char *pathname_a, const char *pathname_b)
bool
paths_init()
{
const char *home_dir, *xdg_config_home, *xdg_log_home;
const char *home_dir;

home_dir = getenv("HOME");
if (home_dir == NULL)
Expand All @@ -703,26 +703,30 @@ paths_init()
goto fail;
}

xdg_config_home = getenv("XDG_CONFIG_HOME");
if (xdg_config_home == NULL)
{
if (!(xdg_config_home = pathname_cat(home_dir, DEFAULT_XDG_CONFIG))) goto fail;
}
g_jackdbus_config_dir = getenv("XDG_CONFIG_HOME");
if (g_jackdbus_config_dir == NULL)
{
if (!(g_jackdbus_config_dir = pathname_cat(home_dir, DEFAULT_XDG_CONFIG))) goto fail;
}

if (!(xdg_log_home = pathname_cat(home_dir, DEFAULT_XDG_LOG))) goto fail;
g_jackdbus_log_dir = getenv("XDG_STATE_HOME");
if (g_jackdbus_log_dir == NULL)
{
if (!(g_jackdbus_log_dir = pathname_cat(home_dir, DEFAULT_XDG_STATE))) goto fail;
}

if (!(g_jackdbus_config_dir = pathname_cat(xdg_config_home, JACKDBUS_DIR))) goto fail;
if (!(g_jackdbus_log_dir = pathname_cat(xdg_log_home, JACKDBUS_DIR))) goto fail;

if (!ensure_dir_exist(xdg_config_home, 0700))
if (!ensure_dir_exist(g_jackdbus_config_dir, 0700))
{
goto fail;
}
if (!(g_jackdbus_config_dir = pathname_cat(g_jackdbus_config_dir, JACKDBUS_DIR))) goto fail;

if (!ensure_dir_exist(xdg_log_home, 0700))
if (!ensure_dir_exist(g_jackdbus_log_dir, 0700))
{
goto fail;
}
if (!(g_jackdbus_log_dir = pathname_cat(g_jackdbus_log_dir, JACKDBUS_DIR))) goto fail;

if (!ensure_dir_exist(g_jackdbus_config_dir, 0700))
{
Expand Down
2 changes: 1 addition & 1 deletion dbus/jackdbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//#define DISABLE_SIGNAL_MAGIC

#define DEFAULT_XDG_CONFIG "/.config"
#define DEFAULT_XDG_LOG "/.log"
#define DEFAULT_XDG_STATE "/.local/state"
#define JACKDBUS_DIR "/jack"
#define JACKDBUS_LOG "/jackdbus.log"
#define JACKDBUS_CONF "/conf.xml"
Expand Down