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

[feature] Allow relative paths in global.conf or mention its usage in docs #13413

Closed
1 task done
gpxricky opened this issue Mar 10, 2023 · 2 comments · Fixed by #13415
Closed
1 task done

[feature] Allow relative paths in global.conf or mention its usage in docs #13413

gpxricky opened this issue Mar 10, 2023 · 2 comments · Fixed by #13415
Assignees
Milestone

Comments

@gpxricky
Copy link

What is your suggestion?

Hi,

unfortunately I wasn't able to use relative paths in the global.conf file. Neither

core.net.http:cacert_path=cacert.pem

nor

core.net.http:cacert_path=/cacert.pem

nor

core.net.http:cacert_path=~/cacert.pem

worked for me when running under Windows. Did I miss some information or is it not supported at present?

In case it is not supported, I highly recommend to add this functionality in order to support company wide configurations. If it is already supported and I just don't know how to use it, then I would highly recommend to provide some example in the documentation.

Many thanks and best regards,
gpxricky

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded
Copy link
Member

Hi @gpxricky

You are right, it is not easy to get access to the current global.conf location from the file, to represent relative paths.
The trick is that relative paths cannot be really managed, they have to be absolute, so they need to be made absolute directly in the template (because the reader of the conf has no idea about what is a path or not, or if it should be relative to what location. A conf might even come defined from the command line, so that means the only way is that absolute paths is what is transmitted.

I have done #13415 to contribute this feature to next 2.0.2. The idea is the same as profile jinja templates, there is a variable called conan_home_folder that you can use to compute the full path:

user.mycompany:myfile = {{os.path.join(conan_home_folder, "myfile")}}

@gpxricky
Copy link
Author

gpxricky commented Mar 10, 2023

Hi @memsharded

this solution would be fine for me. If I may provide some extension to this, I would propose to provide a conan variable for the Jinja2 templates that at present just has a property home_folder. That might be easier to extend in the future in case someone requests other information to be added.

Many thanks,
gpxricky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants