aboutsummaryrefslogtreecommitdiff
path: root/src/common/file_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/file_util.cpp')
-rw-r--r--src/common/file_util.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 1a1f5d9b53..5ab036b343 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -118,8 +118,7 @@ bool IsDirectory(const std::string& filename) {
#endif
if (result < 0) {
- LOG_WARNING(Common_Filesystem, "stat failed on %s: %s", filename.c_str(),
- GetLastErrorMsg());
+ LOG_DEBUG(Common_Filesystem, "stat failed on %s: %s", filename.c_str(), GetLastErrorMsg());
return false;
}
@@ -129,12 +128,12 @@ bool IsDirectory(const std::string& filename) {
// Deletes a given filename, return true on success
// Doesn't supports deleting a directory
bool Delete(const std::string& filename) {
- LOG_INFO(Common_Filesystem, "file %s", filename.c_str());
+ LOG_TRACE(Common_Filesystem, "file %s", filename.c_str());
// Return true because we care about the file no
// being there, not the actual delete.
if (!Exists(filename)) {
- LOG_WARNING(Common_Filesystem, "%s does not exist", filename.c_str());
+ LOG_DEBUG(Common_Filesystem, "%s does not exist", filename.c_str());
return true;
}
@@ -169,8 +168,7 @@ bool CreateDir(const std::string& path) {
return true;
DWORD error = GetLastError();
if (error == ERROR_ALREADY_EXISTS) {
- LOG_WARNING(Common_Filesystem, "CreateDirectory failed on %s: already exists",
- path.c_str());
+ LOG_DEBUG(Common_Filesystem, "CreateDirectory failed on %s: already exists", path.c_str());
return true;
}
LOG_ERROR(Common_Filesystem, "CreateDirectory failed on %s: %i", path.c_str(), error);
@@ -182,7 +180,7 @@ bool CreateDir(const std::string& path) {
int err = errno;
if (err == EEXIST) {
- LOG_WARNING(Common_Filesystem, "mkdir failed on %s: already exists", path.c_str());
+ LOG_DEBUG(Common_Filesystem, "mkdir failed on %s: already exists", path.c_str());
return true;
}
@@ -197,7 +195,7 @@ bool CreateFullPath(const std::string& fullPath) {
LOG_TRACE(Common_Filesystem, "path %s", fullPath.c_str());
if (FileUtil::Exists(fullPath)) {
- LOG_WARNING(Common_Filesystem, "path exists %s", fullPath.c_str());
+ LOG_DEBUG(Common_Filesystem, "path exists %s", fullPath.c_str());
return true;
}
@@ -229,7 +227,7 @@ bool CreateFullPath(const std::string& fullPath) {
// Deletes a directory filename, returns true on success
bool DeleteDir(const std::string& filename) {
- LOG_INFO(Common_Filesystem, "directory %s", filename.c_str());
+ LOG_TRACE(Common_Filesystem, "directory %s", filename.c_str());
// check if a directory
if (!FileUtil::IsDirectory(filename)) {
@@ -303,7 +301,7 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
// copy loop
while (!feof(input)) {
// read input
- int rnum = fread(buffer, sizeof(char), BSIZE, input);
+ size_t rnum = fread(buffer, sizeof(char), BSIZE, input);
if (rnum != BSIZE) {
if (ferror(input) != 0) {
LOG_ERROR(Common_Filesystem, "failed reading from source, %s --> %s: %s",
@@ -313,7 +311,7 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) {
}
// write output
- int wnum = fwrite(buffer, sizeof(char), rnum, output);
+ size_t wnum = fwrite(buffer, sizeof(char), rnum, output);
if (wnum != rnum) {
LOG_ERROR(Common_Filesystem, "failed writing to output, %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
@@ -693,6 +691,8 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string& new
paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
if (!FileUtil::IsDirectory(paths[D_USER_IDX])) {
paths[D_USER_IDX] = AppDataRoamingDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP;
+ } else {
+ LOG_INFO(Common_Filesystem, "Using the local user directory");
}
paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;