qw3rtty / neix

neix - a RSS/Atom feed reader for your terminal.
GNU General Public License v3.0
200 stars 12 forks source link

[BUG] Specify a custom config file always append the path to $HOME #25

Closed k0pernicus closed 2 years ago

k0pernicus commented 2 years ago

Describe the bug I try to release neix in homebrew package manager for macOS.
The issue is specified here.

I am integrating user tests and wanted to integrate this:

  1. extract the default configuration file to feeds.xml,
  2. load the feeds.xml configuration and checks the exit status code.

However, each test is running inside a process, with the binary copied in tmp. So, running the binary inside it returns this error:

Export feeds to: feeds_file.xml
[neix] Failed to load: /private/tmp/neix-test-20210829-51434-1xnt8yj/.config/neix/feeds.conf
[neix] Configuration file not found!"

Then, I wanted to specify manually the configuration file using neix -f /opt/.../feeds.conf, which leads to this error:

[neix] Use custom feed config: /opt/.../feeds.conf
[neix] Starting version v0.1.5
[neix] Loading configuration files
[neix] Failed to load: /Users/k0pernicus/.config/neix//opt/.../feeds.conf
[neix] Configuration file not found!

The binary is not looking from /opt but from my $HOME, extended by the given path (/Users/k0pernicus/.config/neix//opt/.../feeds.conf).

To Reproduce Steps to reproduce the behavior:

  1. Run the following command specifying a file from root: neix -f /home/<user>/feeds.conf

Expected behavior The program should check if the path begins with / to know if the path is absolute, or relative (and then use the $HOME path).
The program should not use $HOME for an absolute path.

Desktop (please complete the following information):

Additional context I used neix with the 0.1.5 tag only.