Skip to content

Commit 2577171

Browse files
authored
Auto opening projects in Eclipse Che environment (#75)
Signed-off-by: Vladyslav Zhukovskyi <vzhukovs@redhat.com>
1 parent c46b95b commit 2577171

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

static/ide-projector-launcher.sh

+17-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,23 @@ sed -i 's+classpath "$CLASSPATH"+classpath "$CLASSPATH:$IDE_HOME/projector-serve
126126
# -Dorg.jetbrains.projector.server.classToLaunch=com.intellij.idea.Main org.jetbrains.projector.server.ProjectorLauncher
127127
sed -i 's+com.intellij.idea.Main+-Dorg.jetbrains.projector.server.classToLaunch=com.intellij.idea.Main org.jetbrains.projector.server.ProjectorLauncher+g' "$IDE_RUN_FILE_NAME-projector.sh"
128128

129-
bash "$IDE_RUN_FILE_NAME-projector.sh" "nosplash"
129+
pathCandidate=""
130+
131+
# che specific configuration to auto open projects
132+
if [ -x "$(command -v yq)" ] && [ -f "$DEVWORKSPACE_FLATTENED_DEVFILE" ] && [ -d "$PROJECTS_ROOT" ]; then
133+
configuredProjectNames=$(yq -r ".projects[]?.name" < "$DEVWORKSPACE_FLATTENED_DEVFILE")
134+
if [ "$(echo -n "$configuredProjectNames" | grep "^.*$" -c)" == 1 ]; then
135+
pathCandidate="$PROJECTS_ROOT/$configuredProjectNames"
136+
else
137+
pathCandidate="$PROJECTS_ROOT"
138+
fi
139+
fi
140+
141+
if [ -n "$pathCandidate" ] && [ -d "$pathCandidate" ]; then
142+
bash "$IDE_RUN_FILE_NAME-projector.sh" "nosplash" "$pathCandidate"
143+
else
144+
bash "$IDE_RUN_FILE_NAME-projector.sh" "nosplash"
145+
fi
130146

131147
rm "$IDE_RUN_FILE_NAME-projector.sh"
132148

0 commit comments

Comments
 (0)