Commit c161bb28 authored by Denis Krjuchkov's avatar Denis Krjuchkov

db/SimpleDatabasePlugin.cxx: don't use CheckAccess with mode on Windows

parent 06d71696
...@@ -71,7 +71,7 @@ SimpleDatabase::Check(Error &error) const ...@@ -71,7 +71,7 @@ SimpleDatabase::Check(Error &error) const
assert(!path.IsNull()); assert(!path.IsNull());
/* Check if the file exists */ /* Check if the file exists */
if (!CheckAccess(path, F_OK)) { if (!CheckAccess(path)) {
/* If the file doesn't exist, we can't check if we can write /* If the file doesn't exist, we can't check if we can write
* it, so we are going to try to get the directory path, and * it, so we are going to try to get the directory path, and
* see if we can write a file in that */ * see if we can write a file in that */
...@@ -94,6 +94,7 @@ SimpleDatabase::Check(Error &error) const ...@@ -94,6 +94,7 @@ SimpleDatabase::Check(Error &error) const
return false; return false;
} }
#ifndef WIN32
/* Check if we can write to the directory */ /* Check if we can write to the directory */
if (!CheckAccess(dirPath, X_OK | W_OK)) { if (!CheckAccess(dirPath, X_OK | W_OK)) {
const int e = errno; const int e = errno;
...@@ -102,7 +103,7 @@ SimpleDatabase::Check(Error &error) const ...@@ -102,7 +103,7 @@ SimpleDatabase::Check(Error &error) const
dirPath_utf8.c_str()); dirPath_utf8.c_str());
return false; return false;
} }
#endif
return true; return true;
} }
...@@ -121,12 +122,14 @@ SimpleDatabase::Check(Error &error) const ...@@ -121,12 +122,14 @@ SimpleDatabase::Check(Error &error) const
return false; return false;
} }
#ifndef WIN32
/* And check that we can write to it */ /* And check that we can write to it */
if (!CheckAccess(path, R_OK | W_OK)) { if (!CheckAccess(path, R_OK | W_OK)) {
error.FormatErrno("Can't open db file \"%s\" for reading/writing", error.FormatErrno("Can't open db file \"%s\" for reading/writing",
path_utf8.c_str()); path_utf8.c_str());
return false; return false;
} }
#endif
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment