mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-02-27 03:31:48 +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 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);
|
const size_t last_slash_idx = filePath.rfind(pathSeparator);
|
||||||
if (std::string::npos != last_slash_idx)
|
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)
|
std::string Utils::getParentDirectory(std::string directory)
|
||||||
{
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
directory = Utils::replace(directory, "/", "\\");
|
||||||
|
#endif
|
||||||
size_t last_slash_idx = directory.find_last_of(pathSeparator);
|
size_t last_slash_idx = directory.find_last_of(pathSeparator);
|
||||||
if(directory.length() - 1 == last_slash_idx)
|
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)
|
std::string Utils::getFileName(std::string filePath)
|
||||||
{
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
filePath = Utils::replace(filePath, "/", "\\");
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string filename = filePath;
|
std::string filename = filePath;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user