mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-05 21:48:55 +01:00
Fixing windows path issues
This commit is contained in:
parent
af820bffb3
commit
b48fe786eb
@ -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;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user