Skip to content

Commit

Permalink
[linux] add convert_path_sep to file_service.cpp and s_device.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
q4a committed Jan 17, 2022
1 parent ea38cdc commit d721731
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/apps/engine/src/file_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ FILE_SERVICE::~FILE_SERVICE()

std::fstream FILE_SERVICE::_CreateFile(const char *filename, std::ios::openmode mode)
{
const auto path = filename ? std::filesystem::u8path(filename) : std::filesystem::path();
const auto path = filename ? std::filesystem::u8path(convert_path_sep(filename)) : std::filesystem::path();
std::fstream fileS(path, mode);
return fileS;
}
Expand All @@ -58,7 +58,7 @@ void FILE_SERVICE::_SetFilePointer(std::fstream &fileS, std::streamoff off, std:

bool FILE_SERVICE::_DeleteFile(const char *filename)
{
std::filesystem::path path = std::filesystem::u8path(filename);
std::filesystem::path path = std::filesystem::u8path(convert_path_sep(filename));
return std::filesystem::remove(path);
}

Expand Down Expand Up @@ -94,7 +94,7 @@ bool FILE_SERVICE::_ReadFile(std::fstream &fileS, void *s, std::streamsize count

bool FILE_SERVICE::_FileOrDirectoryExists(const char *p)
{
std::filesystem::path path = std::filesystem::u8path(p);
std::filesystem::path path = std::filesystem::u8path(convert_path_sep(p));
return std::filesystem::exists(path);
}

Expand Down Expand Up @@ -125,7 +125,7 @@ std::vector<std::filesystem::path> FILE_SERVICE::_GetFsPathsByMask(const char *s
}
else
{
srcPath = std::filesystem::u8path(sourcePath);
srcPath = std::filesystem::u8path(convert_path_sep(sourcePath));
}

std::filesystem::path curPath;
Expand Down Expand Up @@ -171,7 +171,7 @@ std::time_t FILE_SERVICE::_ToTimeT(std::filesystem::file_time_type tp)

std::filesystem::file_time_type FILE_SERVICE::_GetLastWriteTime(const char *filename)
{
std::filesystem::path path = std::filesystem::u8path(filename);
std::filesystem::path path = std::filesystem::u8path(convert_path_sep(filename));
return std::filesystem::last_write_time(path);
}

Expand All @@ -195,25 +195,25 @@ std::string FILE_SERVICE::_GetExecutableDirectory()

std::uintmax_t FILE_SERVICE::_GetFileSize(const char *filename)
{
std::filesystem::path path = std::filesystem::u8path(filename);
std::filesystem::path path = std::filesystem::u8path(convert_path_sep(filename));
return std::filesystem::file_size(path);
}

void FILE_SERVICE::_SetCurrentDirectory(const char *pathName)
{
std::filesystem::path path = std::filesystem::u8path(pathName);
std::filesystem::path path = std::filesystem::u8path(convert_path_sep(pathName));
std::filesystem::current_path(path);
}

bool FILE_SERVICE::_CreateDirectory(const char *pathName)
{
std::filesystem::path path = std::filesystem::u8path(pathName);
std::filesystem::path path = std::filesystem::u8path(convert_path_sep(pathName));
return std::filesystem::create_directories(path);
}

std::uintmax_t FILE_SERVICE::_RemoveDirectory(const char *pathName)
{
std::filesystem::path path = std::filesystem::u8path(pathName);
std::filesystem::path path = std::filesystem::u8path(convert_path_sep(pathName));
return std::filesystem::remove_all(path);
}

Expand Down
2 changes: 1 addition & 1 deletion src/libs/renderer/src/s_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ int32_t DX9RENDER::TextureCreate(const char *fname)
return -1L;
}

std::filesystem::path path = fname;
std::filesystem::path path = convert_path_sep(fname);
std::string pathStr = path.extension().string();
if (storm::iEquals(pathStr, ".tx"))
path.replace_extension();
Expand Down

0 comments on commit d721731

Please sign in to comment.