Properly expand '~' in mpd_host when preceded by a password.

This commit is contained in:
feral_hedgehog
2019-01-26 01:40:15 +02:00
parent 81cb7a4f85
commit 8304cb8e4c

View File

@@ -63,8 +63,12 @@ std::string xdg_config_home()
void expand_home(std::string &path)
{
assert(env_home != nullptr);
if (!path.empty() && path[0] == '~')
path.replace(0, 1, env_home);
if (!path.empty())
{
size_t i = path.find("~");
if (i != std::string::npos && (i == 0 || path[i - 1] == '@'))
path.replace(i, 1, env_home);
}
}
bool configure(int argc, char **argv)