Skip to content

A fully functional Android app built entirely with Kotlin and Jetpack Compose

Make path to module graph image dynamic. Fixes #1286

Don Turner70dcd5119d69
diff --git a/app-nia-catalog/README.md b/app-nia-catalog/README.md
index 99503ba84..cf6d05f4f 100644
--- a/app-nia-catalog/README.md
+++ b/app-nia-catalog/README.md
@@ -1,3 +1,3 @@
# :app-nia-catalog module
## Dependency graph
-![Dependency graph](../../docs/images/graphs/dep_graph_app_nia_catalog.svg)
+![Dependency graph](../docs/images/graphs/dep_graph_app_nia_catalog.svg)
diff --git a/app/README.md b/app/README.md
index f80083494..a3fb4572a 100644
--- a/app/README.md
+++ b/app/README.md
@@ -1,3 +1,3 @@
# :app module
## Dependency graph
-![Dependency graph](../../docs/images/graphs/dep_graph_app.svg)
+![Dependency graph](../docs/images/graphs/dep_graph_app.svg)
diff --git a/generateModuleGraphs.sh b/generateModuleGraphs.sh
index 27dea22da..faeac9a30 100755
--- a/generateModuleGraphs.sh
+++ b/generateModuleGraphs.sh
@@ -56,14 +56,23 @@ check_and_create_readme() {
local file_name="$2"
local readme_path="${module_path:1}" # Remove leading colon
- readme_path=${readme_path//:/\/} # Replace colons with slashes using sed
+ readme_path=${readme_path//:/\/} # Replace colons with slashes
readme_path="${readme_path}/README.md" #Append the filename
# Check if README.md exists and create it if not
if [[ ! -f "$readme_path" ]]; then
echo "Creating README.md for ${module_path}"
- # Calculate the correct relative path to the image
- local relative_image_path="../../docs/images/graphs/${file_name}.svg"
+
+ # Determine the depth of the module based on the number of colons
+ local depth=$(awk -F: '{print NF-1}' <<< "${module_path}")
+
+ # Construct the relative image path with the correct number of "../"
+ local relative_image_path="../"
+ for ((i=1; i<$depth; i++)); do
+ relative_image_path+="../"
+ done
+ relative_image_path+="docs/images/graphs/${file_name}.svg"
+
echo "# ${module_path} module" > "$readme_path"
echo "## Dependency graph" >> "$readme_path"
echo "![Dependency graph](${relative_image_path})" >> "$readme_path"