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

Inconsistent relative build paths for CLI params --output-path and --buildstate-path #1103

Closed
relikd opened this issue Feb 25, 2023 · 2 comments · Fixed by #1120
Closed

Inconsistent relative build paths for CLI params --output-path and --buildstate-path #1103

relikd opened this issue Feb 25, 2023 · 2 comments · Fixed by #1120

Comments

@relikd
Copy link
Contributor

relikd commented Feb 25, 2023

If you provide a relative path to the lektor build command, the paths are relative to different folders.

Consider this folder structure:

CWD
CWD/projdir
CWD/projdir/main.lektorproject

running this command:

lektor build --project projdir --output-path opath --buildstate-path bspath

Creates these two folder:

CWD/projdir/opath/
CWD/bspath/

I find it a bit confusing that output-path is relative to the project file whereas buildstate is relative to the current working directory.

@dairiki
Copy link
Contributor

dairiki commented Mar 10, 2023

Having thought more about this, I'm willing to call this a bug.

In general, it seems unexpected and surprising for any path specified on the command line to be interpreted relative to anything but the current working directory.

Do note that it is also possible to set the output_path in the project file. In that case, I would expect that the path would be interpreted relative to the location of the project file (as is documented).

So we should support both:

  • relative paths specified on the command line (or via environment variables) should be interpreted relative to the current working directory
  • relative paths specified in the project file should be interpreted relative to the location to the project file

To add one more ball to juggle: also note that the location of the project tree — the directory that contains the content, templates, models and other directories comprising the source of the project — isn't necessarily the same as the location of the project file. (The location of the tree can be set by the path setting in the project file.)

@dairiki
Copy link
Contributor

dairiki commented Mar 10, 2023

Another buglet: It appears that relative output_path paths specified in the project file are currently interpreted relative to the project tree (see here). As previously noted the documentation says it should be interpreted relative to the location of the project file — and I think that makes more sense.
(The project tree is usually but not necessarily the same as the location of the project file.)

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 a pull request may close this issue.

2 participants