diff options
author | Max Kellermann <max@musicpd.org> | 2018-07-17 17:02:49 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-07-17 17:02:49 +0200 |
commit | 79e89eb23b554248e4b86631109ae551df6c8d48 (patch) | |
tree | 497d9ac705cecd06f168fcb63137e39b36dacb2b /src/CommandLine.cxx | |
parent | d13a64455cca4073ac3b123b14af8390afba81e1 (diff) |
CommandLine: use constexpr Path instead of macros
Diffstat (limited to 'src/CommandLine.cxx')
-rw-r--r-- | src/CommandLine.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx index 27224a41d..ecfae241e 100644 --- a/src/CommandLine.cxx +++ b/src/CommandLine.cxx @@ -67,14 +67,16 @@ #include <stdio.h> #include <stdlib.h> +namespace { #ifdef _WIN32 -#define CONFIG_FILE_LOCATION PATH_LITERAL("mpd\\mpd.conf") -#define APP_CONFIG_FILE_LOCATION PATH_LITERAL("conf\\mpd.conf") +constexpr auto CONFIG_FILE_LOCATION = Path::FromFS(PATH_LITERAL("mpd\\mpd.conf")); +constexpr auto APP_CONFIG_FILE_LOCATION = Path::FromFS(PATH_LITERAL("conf\\mpd.conf")); #else -#define USER_CONFIG_FILE_LOCATION1 PATH_LITERAL(".mpdconf") -#define USER_CONFIG_FILE_LOCATION2 PATH_LITERAL(".mpd/mpd.conf") -#define USER_CONFIG_FILE_LOCATION_XDG PATH_LITERAL("mpd/mpd.conf") +constexpr auto USER_CONFIG_FILE_LOCATION1 = Path::FromFS(PATH_LITERAL(".mpdconf")); +constexpr auto USER_CONFIG_FILE_LOCATION2 = Path::FromFS(PATH_LITERAL(".mpd/mpd.conf")); +constexpr auto USER_CONFIG_FILE_LOCATION_XDG = Path::FromFS(PATH_LITERAL("mpd/mpd.conf")); #endif +} enum Option { OPTION_KILL, @@ -292,8 +294,7 @@ class ConfigLoader { public: bool TryFile(const Path path); - bool TryFile(const AllocatedPath &base_path, - PathTraitsFS::const_pointer_type path); + bool TryFile(const AllocatedPath &base_path, Path path); }; bool ConfigLoader::TryFile(Path path) @@ -305,8 +306,7 @@ bool ConfigLoader::TryFile(Path path) return false; } -bool ConfigLoader::TryFile(const AllocatedPath &base_path, - PathTraitsFS::const_pointer_type path) +bool ConfigLoader::TryFile(const AllocatedPath &base_path, Path path) { if (base_path.IsNull()) return false; |