From 364e7df4d76c881a4d0e0046371ff086e20f13e4 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 10 May 2016 20:37:36 -0400 Subject: [PATCH] Fix: Java agent should use LTTNG_HOME Both in UST C/C++ support and Python agent, LTTNG_HOME can be used to override HOME for lttng-ust. Ensure the Java agent has the same behavior. Fixes: #881 Signed-off-by: Mathieu Desnoyers --- .../org/lttng/ust/agent/LTTngTCPSessiondClient.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java b/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java index 76e8426b..78dae5e5 100644 --- a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java +++ b/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java @@ -262,7 +262,16 @@ class LTTngTCPSessiondClient implements Runnable { } private static String getHomePath() { - return System.getProperty("user.home"); + /* + * The environment variable LTTNG_HOME overrides HOME if + * defined. + */ + String homePath = System.getenv("LTTNG_HOME"); + + if (homePath == null) { + homePath = System.getProperty("user.home"); + } + return homePath; } /** -- 2.34.1