/*
* InspIRCd -- Internet Relay Chat Daemon
*
- * Copyright (C) 2013 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2013, 2019-2020 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2013 Attila Molnar <attilamolnar@hush.com>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public
if (fragment[0] == '/' || FileSystem::StartsWithWindowsDriveLetter(fragment))
return fragment;
+ // The fragment is relative to a home directory, expand that.
+ if (!fragment.compare(0, 2, "~/", 2))
+ {
+ const char* homedir = getenv("HOME");
+ if (homedir && *homedir)
+ return std::string(homedir) + '/' + fragment.substr(2);
+ }
+
return base + '/' + fragment;
}