android + common: fix warnings

This commit is contained in:
SachinVin 2023-06-09 22:50:05 +05:30
parent 8eb89c260d
commit 946a32d793
3 changed files with 29 additions and 44 deletions

View file

@ -102,12 +102,11 @@ static void StripTailDirSlashes(std::string& fname) {
}
bool Exists(const std::string& filename) {
struct stat file_info;
std::string copy(filename);
StripTailDirSlashes(copy);
#ifdef _WIN32
struct stat file_info;
// Windows needs a slash to identify a driver root
if (copy.size() != 0 && copy.back() == ':')
copy += DIR_SEP_CHR;
@ -116,6 +115,7 @@ bool Exists(const std::string& filename) {
#elif ANDROID
int result = AndroidStorage::FileExists(filename) ? 0 : -1;
#else
struct stat file_info;
int result = stat(copy.c_str(), &file_info);
#endif
@ -699,7 +699,7 @@ static const std::string& GetHomeDirectory() {
* @return The directory path
* @sa http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
*/
static const std::string GetUserDirectory(const std::string& envvar) {
[[maybe_unused]] static const std::string GetUserDirectory(const std::string& envvar) {
const char* directory = getenv(envvar.c_str());
std::string user_dir;