Skip to content

Commit

Permalink
#165 : StkPlGetFileSize calls stat() for getting file size.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-takeuchi committed Nov 10, 2023
1 parent 135e583 commit cabe05a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/stkpl/StkPl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1630,12 +1630,12 @@ size_t StkPlGetFileSize(const wchar_t FilePath[FILENAME_MAX])
#else
uintmax_t FileSize = 0;
char* FilePathUtf8 = StkPlCreateUtf8FromWideChar(FilePath);
try {
FileSize = std::experimental::filesystem::file_size(FilePathUtf8);
} catch (std::experimental::filesystem::filesystem_error ex) {
struct stat TmpSt;
if (stat(FilePathUtf8, &TmpSt) != 0) {
delete FilePathUtf8;
return -1;
}
FileSize = TmpSt.st_size;
delete FilePathUtf8;
if (FileSize == 0) {
return 0;
Expand Down

0 comments on commit cabe05a

Please sign in to comment.