Skip to content

Commit

Permalink
Dichotomy of problem with FCBak
Browse files Browse the repository at this point in the history
  • Loading branch information
0penBrain committed Jul 23, 2023
1 parent 2dfab2f commit 8e1aeeb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
7 changes: 5 additions & 2 deletions src/App/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,9 @@ class BackupPolicy {
"Cannot rename tmp save file to project file", targetname);
}
}

#include <stdio.h>

void applyTimeStamp(const std::string& sourcename, const std::string& targetname) {
Base::FileInfo fi(targetname);

Expand Down Expand Up @@ -1669,15 +1672,16 @@ class BackupPolicy {
Base::FileInfo di(fi.dirPath());
std::vector<Base::FileInfo> backup;
std::vector<Base::FileInfo> files = di.getDirectoryContent();
/********** If FOR block commented, CI passes *************/
for (std::vector<Base::FileInfo>::iterator it = files.begin(); it != files.end(); ++it) {
std::cout << "FILE : " << it->fileName() << std::endl << std::flush;
if (it->isFile()) {
std::string file = it->fileName();
std::string fext = it->extension();
std::string fextUp = fext;
std::transform(fextUp.begin(), fextUp.end(), fextUp.begin(),(int (*)(int))toupper);
// re-enforcing identification of the backup file


// old case : the name starts with the full name of the project and follows with numbers
if ((startsWith(file, fn) &&
(file.length() > fn.length()) &&
Expand Down Expand Up @@ -1711,7 +1715,6 @@ class BackupPolicy {
}
}
}

}
} //end remove backup

Expand Down
11 changes: 4 additions & 7 deletions src/Base/FileInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,10 @@ bool FileInfo::isFile() const
}
#else
if (exists()) {
// If we can open it must be an existing file, otherwise we assume it
// is a directory (which doesn't need to be true for any cases)
std::ifstream str(FileName.c_str(), std::ios::in | std::ios::binary);
if (!str)
return false;
str.close();
return true;
struct stat s;
if( (stat(FileName.c_str(), &s) == 0) && (s.st_mode & S_IFREG) )
return true;
return false;
}
#endif

Expand Down

0 comments on commit 8e1aeeb

Please sign in to comment.