Permalink
Browse files

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>
  • Loading branch information...
1 parent ce10cee commit cb2e50a5bd79697c3299d50d5e2596821d87fa62 @psychon psychon committed Feb 20, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 FileUtils.cpp
View
@@ -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("/");

0 comments on commit cb2e50a

Please sign in to comment.