Fixing windows path issues

This commit is contained in:
emb 2015-08-03 23:00:04 -05:00
parent af820bffb3
commit b48fe786eb

View File

@ -194,8 +194,11 @@ void Utils::replaceSlashesWithUnderscores(std::string &content)
std::string Utils::getDirectory(std::string filePath)
{
std::string directory = filePath;
#ifdef WIN32
filePath = Utils::replace(filePath, "/", "\\");
#endif
std::string directory = filePath;
const size_t last_slash_idx = filePath.rfind(pathSeparator);
if (std::string::npos != last_slash_idx)
{
@ -207,6 +210,9 @@ std::string Utils::getDirectory(std::string filePath)
std::string Utils::getParentDirectory(std::string directory)
{
#ifdef WIN32
directory = Utils::replace(directory, "/", "\\");
#endif
size_t last_slash_idx = directory.find_last_of(pathSeparator);
if(directory.length() - 1 == last_slash_idx)
{
@ -225,6 +231,9 @@ std::string Utils::getParentDirectory(std::string directory)
std::string Utils::getFileName(std::string filePath)
{
#ifdef WIN32
filePath = Utils::replace(filePath, "/", "\\");
#endif
std::string filename = filePath;