From 3a8fa168d08b713e63e9f6daf122cf26e3386aba Mon Sep 17 00:00:00 2001 From: Hugo Dutka Date: Fri, 30 May 2025 19:40:23 +0200 Subject: [PATCH] fix(claude-code): create folder if it does not exist (#124) --- registry/coder/modules/claude-code/main.tf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/registry/coder/modules/claude-code/main.tf b/registry/coder/modules/claude-code/main.tf index cc7b27e0..296fa59c 100644 --- a/registry/coder/modules/claude-code/main.tf +++ b/registry/coder/modules/claude-code/main.tf @@ -97,6 +97,16 @@ resource "coder_script" "claude_code" { command -v "$1" >/dev/null 2>&1 } + # Check if the specified folder exists + if [ ! -d "${var.folder}" ]; then + echo "Warning: The specified folder '${var.folder}' does not exist." + echo "Creating the folder..." + # The folder must exist before tmux is started or else claude will start + # in the home directory. + mkdir -p "${var.folder}" + echo "Folder created successfully." + fi + # Run pre-install script if provided if [ -n "${local.encoded_pre_install_script}" ]; then echo "Running pre-install script..."