如何在 RCPTT 中使用 eclipse 命令行脚本查找用户主路径?

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

就像我们有一些脚本可以找到 eclipse 安装位置作为 {workspace_loc}。我尝试了更多的语法,但 none 告诉了我一个方法。

如果您的程序是从用户库中的工作区启动的,那么下面的 ECL 脚本就可以工作。仅 Windows;如果您需要基于 Unix 的解决方案,只需将“\\”文字更改为“/”文字即可。

/* 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
            }
    }
}

我找到了一种使用环境变量定位用户目录的方法

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

以上代码是定位用户目录。