CFile: Handle paths like "~/foo"

This let's CFile expand relative-to-home paths. I "accidentally" broke
ISpoofFile with some recent commit and that is now fixed with this. This should
solve this problem for quite a lot of other places, too.

Idea (c) by DarthGandalf, thanks. :)

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter
2011-02-20 11:10:16 +01:00
parent ce10cee260
commit cb2e50a5bd

View File

@@ -37,7 +37,10 @@ CFile::~CFile() {
}
void CFile::SetFileName(const CString& sLongName) {
m_sLongName = sLongName;
if (sLongName.Left(2) == "~/") {
m_sLongName = CZNC::Get().GetHomePath() + sLongName.substr(1);
} else
m_sLongName = sLongName;
m_sShortName = sLongName;
m_sShortName.TrimRight("/");