Change config file path.
continuous-integration/drone/push Build was killed Details

Existing old config file is copied over.
This commit is contained in:
tastytea 2021-05-31 19:37:11 +02:00
parent b966be3021
commit 77d013c12a
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 13 additions and 4 deletions

View File

@ -2,7 +2,7 @@
:doctype: manpage
:Author: tastytea
:Email: tastytea@tastytea.de
:Date: 2021-05-30
:Date: 2021-05-31
:Revision: 0.0.0
:man source: epubgrep
:man manual: General Commands Manual
@ -130,8 +130,8 @@ regexp = [Oo]regano
== FILES
*Configuration file*::
* If `XDG_CONFIG_HOME` is defined: `${XDG_CONFIG_HOME}/epubgrep.conf`
* If `HOME` is defined: `${HOME}/.config/epubgrep.conf`
* If `XDG_CONFIG_HOME` is defined: `${XDG_CONFIG_HOME}/epubgrep/epubgrep.conf`
* If `HOME` is defined: `${HOME}/.config/epubgrep/epubgrep.conf`
* Otherwise: `epubgrep.conf`

View File

@ -161,7 +161,16 @@ fs::path get_config_path()
}
if (!path.empty())
{
return path /= "epubgrep.conf";
const auto old_path{path / "epubgrep.conf"};
auto new_path{path / "epubgrep" / "epubgrep.conf"};
if (fs::exists(old_path))
{
fs::create_directory(path /= "epubgrep");
fs::rename(old_path, new_path);
}
return new_path;
}
return "epubgrep.conf";