TMF: Add possibility to overwrite the path of the workspace root
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Wed, 8 Jan 2014 19:20:45 +0000 (14:20 -0500)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Thu, 9 Jan 2014 01:59:40 +0000 (20:59 -0500)
By setting the environment variable TRACING_RCP_ROOT on the command line,
it uses this path as the workspace root instead of the default user home
directory.

Change-Id: I3cadec5b162e1dac99c4b5b9f30308a21c351f50
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/20400
Tested-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
org.eclipse.linuxtools.tracing.rcp.ui/src/org/eclipse/linuxtools/internal/tracing/rcp/ui/TracingRcpPlugin.java

index c2863df1eecd956dc7da037bae221d2379ac7fdb..1ad47df7d4a22d7a22558c89bbb137c11c0ea513 100644 (file)
@@ -71,12 +71,20 @@ public class TracingRcpPlugin extends AbstractUIPlugin {
     }
 
     /**
-     * Gets the tracing workspace root directory
+     * Gets the tracing workspace root directory. By default it uses the user's
+     * home directory. This value can be overwritten by using the global
+     * TRACING_RCP_ROOT environment variable.
      *
      * @return the tracing workspace root directory
      */
     public static String getWorkspaceRoot() {
-        return System.getProperty("user.home"); //$NON-NLS-1$
+        /* Look for the environment variable in the global environment variables */
+        String workspaceRoot = System.getenv().get("TRACING_RCP_ROOT"); //$NON-NLS-1$
+        if (workspaceRoot == null) {
+            /* Use the user's home directory */
+            workspaceRoot = System.getProperty("user.home"); //$NON-NLS-1$
+        }
+        return workspaceRoot;
     }
 
     // ------------------------------------------------------------------------
This page took 0.03304 seconds and 5 git commands to generate.