how to find user home path using eclipse command line script in RCPTT?

458 views Asked by At

Like we have some scripts to find eclipse installed location as {workspace_loc}. I've tried with some more syntax but none of them show me a way.

2

There are 2 answers

0
Jagadeesh Pulamarasetti On BEST ANSWER

I found myself a way to locate user directory using environment variables

substitute-variables "${system_property:user.home}"

Above code is locating user directory.

1
Adam Horvath On

This ECL script below works if your program is started with a workspace in the user's library. It's Windows only; if you need Unix-based solution simply change the "\\" literals to "/" literals.

/* Stores User's home path into global "user_home" if workspace location is within the user folder.  */
proc introduce_user_home {
    // Splitting up workspace path
    let [val splitted [get-workspace-location | split -sep "\\" | to-list]] {
        let [val user_part
            // Concatenating the part that matters
            [concat [$splitted | get 0 | str] // C:
                    "\\"
                    [$splitted | get 1 | str] // Users
                    "\\"
                    [$splitted | get 2 | str] // Jagadeesh
            ]] {
                get-window $user_part
                // Introducing it as a global
                global [val "user_home" [$user_part]] -override true
            }
    }
}