summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
b7bc910)
By default xds-server uses $HOME/xds-workspace directory to access to
user shared workspace directory. This root directory may be
changed by defining XDS_SERVER_WORKSPACE_DIR environment variable.
Change-Id: Ib786ba9a954b0b093216295d37236a80f78f2f2c
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
return path.Join(root, "/.xds/server")
}
return path.Join(root, "/.xds/server")
}
+
+// WorkspaceRootDir return the path on server side where user xds-workspace dir is accessible
+func WorkspaceRootDir() string {
+ // May be overloaded by an env variable
+ if envVar, envDef := os.LookupEnv("XDS_SERVER_WORKSPACE_DIR"); envDef {
+ return envVar
+ }
+
+ home := "${HOME}"
+ if usr, err := user.Current(); err == nil {
+ home = usr.HomeDir
+ }
+
+ // Default value $HOME/xds-workspace
+ return path.Join(home, "xds-workspace")
+}
"sync"
common "gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git/golib"
"sync"
common "gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git/golib"
+ "gerrit.automotivelinux.org/gerrit/src/xds/xds-server/lib/xdsconfig"
"gerrit.automotivelinux.org/gerrit/src/xds/xds-server/lib/xsapiv1"
)
"gerrit.automotivelinux.org/gerrit/src/xds/xds-server/lib/xsapiv1"
)
} else if filepath != "" {
// FIXME support any location and also sharing either by pathmap or Syncthing
} else if filepath != "" {
// FIXME support any location and also sharing either by pathmap or Syncthing
- baseDir := "${HOME}/xds-workspace/sdks"
+
+ baseDir := path.Join(xdsconfig.WorkspaceRootDir(), "sdks")
sdkFilename, _ = common.ResolveEnvVar(path.Join(baseDir, path.Base(filepath)))
if !common.Exists(sdkFilename) {
return nil, fmt.Errorf("SDK file not accessible, must be in %s", baseDir)
sdkFilename, _ = common.ResolveEnvVar(path.Join(baseDir, path.Base(filepath)))
if !common.Exists(sdkFilename) {
return nil, fmt.Errorf("SDK file not accessible, must be in %s", baseDir)