mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 11:28:56 +00:00
CFILE: convert cf_Diff() to use std::fs::path
Convert cf_Diff() and underlying functions to use std::filesystem::path
This commit is contained in:
parent
c47210be75
commit
81555afd15
@ -1073,7 +1073,7 @@ bool cf_CopyFile(const std::filesystem::path &dest, const std::filesystem::path
|
||||
|
||||
// Checks to see if two files are different.
|
||||
// Returns TRUE if the files are different, or FALSE if they are the same.
|
||||
bool cf_Diff(const char *a, const char *b) { return (ddio_FileDiff(a, b)); }
|
||||
bool cf_Diff(const std::filesystem::path &a, const std::filesystem::path &b) { return (ddio_FileDiff(a, b)); }
|
||||
|
||||
// Copies the file time from one file to another
|
||||
void cf_CopyFileTime(const std::filesystem::path &dest, const std::filesystem::path &src) {
|
||||
|
@ -313,7 +313,7 @@ bool cf_CopyFile(const std::filesystem::path &dest, const std::filesystem::path
|
||||
|
||||
// Checks to see if two files are different.
|
||||
// Returns TRUE if the files are different, or FALSE if they are the same.
|
||||
bool cf_Diff(const char *a, const char *b);
|
||||
bool cf_Diff(const std::filesystem::path &a, const std::filesystem::path &b);
|
||||
|
||||
// Copies the file time from one file to another
|
||||
void cf_CopyFileTime(const std::filesystem::path &dest, const std::filesystem::path &src);
|
||||
|
@ -341,7 +341,7 @@ int ddio_GetFileLength(FILE *filePtr);
|
||||
|
||||
// check if two files are different
|
||||
// This pathname is *RELATIVE* not fully qualified
|
||||
bool ddio_FileDiff(const char *fileNameA, const char *fileNameB);
|
||||
bool ddio_FileDiff(const std::filesystem::path &path1, const std::filesystem::path &path2);
|
||||
|
||||
// copies one files timestamp to another
|
||||
void ddio_CopyFileTime(const std::filesystem::path &dest, const std::filesystem::path &src);
|
||||
|
@ -94,13 +94,13 @@ void ddio_GetWorkingDir(char *path, int len) { getcwd(path, len); }
|
||||
|
||||
bool ddio_SetWorkingDir(const char *path) { return (chdir(path)) ? false : true; }
|
||||
|
||||
bool ddio_FileDiff(const char *path1, const char *path2) {
|
||||
struct stat abuf, bbuf;
|
||||
bool ddio_FileDiff(const std::filesystem::path &path1, const std::filesystem::path &path2) {
|
||||
struct stat abuf{}, bbuf{};
|
||||
|
||||
if (stat(path1, &abuf))
|
||||
if (stat(path1.u8string().c_str(), &abuf))
|
||||
Int3(); // error getting stat info
|
||||
|
||||
if (stat(path2, &bbuf))
|
||||
if (stat(path2.u8string().c_str(), &bbuf))
|
||||
Int3(); // error getting stat info
|
||||
|
||||
if ((abuf.st_size != bbuf.st_size) || (abuf.st_mtime != bbuf.st_mtime))
|
||||
|
@ -167,13 +167,13 @@ void ddio_GetWorkingDir(char *path, int len) { GetCurrentDirectory(len, path); }
|
||||
|
||||
bool ddio_SetWorkingDir(const char *path) { return (SetCurrentDirectory(path)) ? true : false; }
|
||||
|
||||
bool ddio_FileDiff(const char *path1, const char *path2) {
|
||||
bool ddio_FileDiff(const std::filesystem::path &path1, const std::filesystem::path &path2) {
|
||||
struct _stat abuf, bbuf;
|
||||
|
||||
if (_stat(path1, &abuf))
|
||||
if (_stat(path1.u8string().c_str(), &abuf))
|
||||
Int3(); // error getting stat info
|
||||
|
||||
if (_stat(path2, &bbuf))
|
||||
if (_stat(path2.u8string().c_str(), &bbuf))
|
||||
Int3(); // error getting stat info
|
||||
|
||||
if ((abuf.st_size != bbuf.st_size) || (abuf.st_mtime != bbuf.st_mtime))
|
||||
|
Loading…
Reference in New Issue
Block a user