Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing relative imports for extopenscad. #487

Merged
merged 2 commits into from
Apr 19, 2024

Conversation

lepsa
Copy link
Contributor

@lepsa lepsa commented Apr 18, 2024

Fix for issue: #276

When exteopnscad is called with a source filepath outside of the current directory, relative filepaths such as "../config.scad" would fail to read if no such file relative to the programs directory, not the source file, existed.

This change uses the directory of the initial source file as the location for relative file lookups.

Testing

I couldn't find an example of automated tests for handwritten scad files, so I'm putting a test script here.

From the root directory of the project, invoke the following commands. This tests relative paths going up and down the filesystem, along with checking the same directory.

  • cabal run extopenscad -- -O tests/imports/neighbour.scad
  • cabal run extopenscad -- -O tests/imports/relative/parent.scad
  • cabal run extopenscad -- -O tests/imports/relative/deep/grandparent.scad
  • cabal run extopenscad -- -O tests/imports/child.scad

All of these calls should succeed in generating the same shape, cube(1,2,3).

cd into tests/imports and run the following command to check that relative paths from the invoking directory work.

  • cabal run extopenscad -- -O neighbour.scad

This command should also succeed, producing the same shape.

When exteopnscad is called with a source filepath outside of the current
directory, relative filepaths such as "../config.scad" would fail to
read if no such file relative to the _programs_ directory, not the
source file, existed.

This change uses the directory of the initial source file as the
location for relative file lookups.
@julialongtin julialongtin merged commit 53de0c7 into Haskell-Things:master Apr 19, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants