puppetlabs / cpp-hocon

A C++ port of the Typesafe Config library.
Other
81 stars 57 forks source link

Include file doesn't work probably for relative paths #139

Open Etcham opened 3 months ago

Etcham commented 3 months ago

Description

I made 3 different .conf files where conf_file1 includes conf_file2, and conf_file2 includes conf_file3, each include the conf_file with relative path to it. I put the 3 files in the same directory where I should include any of them using include file("conf_file2.conf"). I have also put the exe of the built cpp-application parsing these files in the parent directory. The structure looks like this: parent_dir simple_cpp_linux_app.stexe
config_files config_file1
config_file2
|
config_file3

When I write in config_file1 include file("conf_file2.conf"), it doesn't get resolved and the file is not included. But, if I write it like this include file("./config_files/conf_file2.conf"), it resolves and included the file successfully. Note that this happens only for the first include, second file (config_file2) includes config_file3 normally (include file("conf_file3.conf"),)

Expected behavior

The expected behavior as described here hocon documentation shows that relative paths should work relative to including file.

Steps to Reproduce

Create a simple cpp-hocon application that parses some .conf file that includes another .conf file where executable is in a different path than the .conf files. Run the application.

Environment