mirror of
https://github.com/znc/znc.git
synced 2026-05-05 21:12:37 +02:00
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:
@@ -37,7 +37,10 @@ CFile::~CFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CFile::SetFileName(const CString& sLongName) {
|
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 = sLongName;
|
||||||
m_sShortName.TrimRight("/");
|
m_sShortName.TrimRight("/");
|
||||||
|
|||||||
Reference in New Issue
Block a user