This commit is contained in:
d1str4ught
2025-08-18 19:46:48 +02:00
parent 65582e25ec
commit 4be475f111
1334 changed files with 456590 additions and 0 deletions

59
src/EterLib/PathStack.cpp Normal file
View File

@@ -0,0 +1,59 @@
#include "StdAfx.h"
#include "PathStack.h"
CPathStack::CPathStack()
{
SetBase();
}
CPathStack::~CPathStack()
{
MoveBase();
}
void CPathStack::GetCurrentPathName(std::string* pstCurPathName)
{
assert(pstCurPathName!=NULL);
char szPathName[MAX_PATH+1];
_getcwd(szPathName, MAX_PATH);
*pstCurPathName = szPathName;
}
void CPathStack::Push()
{
char szPathName[MAX_PATH+1];
_getcwd(szPathName, MAX_PATH);
m_stPathNameDeque.push_front(szPathName);
}
bool CPathStack::Pop()
{
if (m_stPathNameDeque.empty())
{
assert(!"CPathStack::Pop Empty Stack");
return false;
}
_chdir(m_stPathNameDeque.front().c_str());
m_stPathNameDeque.pop_front();
return true;
}
void CPathStack::MoveBase()
{
_chdir(m_stBasePathName.c_str());
}
void CPathStack::SetBase()
{
GetCurrentPathName(&m_stBasePathName);
}
void CPathStack::Move(const char* c_szPathName)
{
_chdir(c_szPathName);
}