From cb2e50a5bd79697c3299d50d5e2596821d87fa62 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 20 Feb 2011 11:10:16 +0100 Subject: [PATCH] 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 --- FileUtils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/FileUtils.cpp b/FileUtils.cpp index 6b0f796b..4f7468c7 100644 --- a/FileUtils.cpp +++ b/FileUtils.cpp @@ -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("/");