fix(import): handle absolute file paths in ralph-import

Previously, ralph-import would prepend '../' to the source file path
after cd'ing into the project directory. This breaks when an absolute
path is provided (e.g., /Users/foo/file.md becomes ..//Users/foo/file.md).

Now checks if the path is absolute (starts with /) before prepending '../'.

Credit: @GiladSchneider (PR #92)
This commit is contained in:
Test User 2026-02-02 09:32:17 -07:00
parent 48ba86a2de
commit 5f3a1226b7

View file

@ -600,7 +600,11 @@ main() {
# Copy source file to project (uses basename since we cd'd into project)
local source_basename
source_basename=$(basename "$source_file")
cp "../$source_file" "$source_basename"
if [[ "$source_file" == /* ]]; then
cp "$source_file" "$source_basename"
else
cp "../$source_file" "$source_basename"
fi
# Run conversion using local copy (basename, not original path)
convert_prd "$source_basename" "$project_name"