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:
parent
48ba86a2de
commit
5f3a1226b7
1 changed files with 5 additions and 1 deletions
|
|
@ -600,7 +600,11 @@ main() {
|
||||||
# Copy source file to project (uses basename since we cd'd into project)
|
# Copy source file to project (uses basename since we cd'd into project)
|
||||||
local source_basename
|
local source_basename
|
||||||
source_basename=$(basename "$source_file")
|
source_basename=$(basename "$source_file")
|
||||||
|
if [[ "$source_file" == /* ]]; then
|
||||||
|
cp "$source_file" "$source_basename"
|
||||||
|
else
|
||||||
cp "../$source_file" "$source_basename"
|
cp "../$source_file" "$source_basename"
|
||||||
|
fi
|
||||||
|
|
||||||
# Run conversion using local copy (basename, not original path)
|
# Run conversion using local copy (basename, not original path)
|
||||||
convert_prd "$source_basename" "$project_name"
|
convert_prd "$source_basename" "$project_name"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue