conan-io / conan-io/docs

[question] [conan2] [config] How do I specify a path containing "~" in global.conf?

Open
#3,670 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
125
Forks
382
Avg merge
22h 39m
Merged PRs (30d)
21

Description

### What is your question?

I'm on Conan 2.2.2, trying to find a workaround for conan-io/docs#3732 on Windows. I can bake certificates into a file and then reference it in global.conf.

However, on both Windows and Linux, Conan is very picky about the directory string. It doesn't recognize the meaning of the tilde:
```
core.net.http:cacert_path = ~/.conan2/cacert.pem
```
It also doesn't recognize environment variables:
```
core.net.http:cacert_path = ${HOME}/.conan2/cacert.pem
```
And relative paths don't work either (with both files in the same directory):
```
core.net.http:cacert_path = cacert.pem
```
If I manually type out the full path, then things work:
```
core.net.http:cacert.path = /home/foo/.conan2/cacert.pem
```
But this doesn't make for an easily generalizable system that works out of the box for all devs and CI systems.

I then thought about setting the configuration value from a bash script, letting bash expand the path. But I see that Conan2 no longer supports `conan config set foo=bar`. Between this and conan-io/docs#3732 I'm getting frustrated with the removal of critical features I was using in Conan 1.61.0.

Finally I tried looking into the Jinja2 API to see if I could construct a path that way, using the double-braces templating. But I got lost very quickly in that as I've never used it before.

Windows 10 and Ubuntu 22.04
Conan 2.2.2
gcc and msbuild

### Have you read the CONTRIBUTING guide?

- [X] I've read the CONTRIBUTING guide

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.