CommandLine: use constexpr Path instead of macros
This commit is contained in:
parent
d13a64455c
commit
79e89eb23b
@ -67,14 +67,16 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
namespace {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define CONFIG_FILE_LOCATION PATH_LITERAL("mpd\\mpd.conf")
|
constexpr auto CONFIG_FILE_LOCATION = Path::FromFS(PATH_LITERAL("mpd\\mpd.conf"));
|
||||||
#define APP_CONFIG_FILE_LOCATION PATH_LITERAL("conf\\mpd.conf")
|
constexpr auto APP_CONFIG_FILE_LOCATION = Path::FromFS(PATH_LITERAL("conf\\mpd.conf"));
|
||||||
#else
|
#else
|
||||||
#define USER_CONFIG_FILE_LOCATION1 PATH_LITERAL(".mpdconf")
|
constexpr auto USER_CONFIG_FILE_LOCATION1 = Path::FromFS(PATH_LITERAL(".mpdconf"));
|
||||||
#define USER_CONFIG_FILE_LOCATION2 PATH_LITERAL(".mpd/mpd.conf")
|
constexpr auto USER_CONFIG_FILE_LOCATION2 = Path::FromFS(PATH_LITERAL(".mpd/mpd.conf"));
|
||||||
#define USER_CONFIG_FILE_LOCATION_XDG PATH_LITERAL("mpd/mpd.conf")
|
constexpr auto USER_CONFIG_FILE_LOCATION_XDG = Path::FromFS(PATH_LITERAL("mpd/mpd.conf"));
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
enum Option {
|
enum Option {
|
||||||
OPTION_KILL,
|
OPTION_KILL,
|
||||||
@ -292,8 +294,7 @@ class ConfigLoader
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool TryFile(const Path path);
|
bool TryFile(const Path path);
|
||||||
bool TryFile(const AllocatedPath &base_path,
|
bool TryFile(const AllocatedPath &base_path, Path path);
|
||||||
PathTraitsFS::const_pointer_type path);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ConfigLoader::TryFile(Path path)
|
bool ConfigLoader::TryFile(Path path)
|
||||||
@ -305,8 +306,7 @@ bool ConfigLoader::TryFile(Path path)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfigLoader::TryFile(const AllocatedPath &base_path,
|
bool ConfigLoader::TryFile(const AllocatedPath &base_path, Path path)
|
||||||
PathTraitsFS::const_pointer_type path)
|
|
||||||
{
|
{
|
||||||
if (base_path.IsNull())
|
if (base_path.IsNull())
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user