GitHub Viewer
#include "Utils.h"
// Get current working directory
string Utils::GetCurrentDir()
{
char buffer[1024];
string sContent = "";
DWORD r = GetCurrentDirectory(1024, buffer);
if (r == 0) return "";
sContent = buffer;
return sContent;
}
// Check if a file exists
bool Utils::FileExists(string p_sPath)
{
DWORD dwAttrib = GetFileAttributes(p_sPath.c_str());
return (dwAttrib != INVALID_FILE_ATTRIBUTES);
}
// Delete a file
bool Utils::DeleteSourceFile(string p_sFile)
{
return (bool)DeleteFile(p_sFile.c_str());
}
// Function used to read a file
string Utils::ReadSourceFile(string p_sFilename)
{
string contents = "";
cout