diff --git a/radio/src/targets/simu/simufatfs.cpp b/radio/src/targets/simu/simufatfs.cpp index 16bd0b1f7..600199e9c 100644 --- a/radio/src/targets/simu/simufatfs.cpp +++ b/radio/src/targets/simu/simufatfs.cpp @@ -20,24 +20,31 @@ #include "opentx.h" -#if defined _MSC_VER || !defined (__GNUC__) - #define MSVC_BUILD +#if defined(SIMU_USE_SDCARD) // rest of file is excluded otherwise + +#if defined(_MSC_VER) || !defined (__GNUC__) + #define MSVC_BUILD 1 +#else + #define MSVC_BUILD 0 #endif -#if defined(SIMU_USE_SDCARD) -#if defined(MSVC_BUILD) +// NOTE: the #include order is important here, sensitive on different platoforms. +#include +#include +#include +#include +#include + +#if MSVC_BUILD #include #include #include #define mkdir(s, f) _mkdir(s) #else + #include #include #endif -#include -#include -#include -#include #include "ff.h" #include #include @@ -130,7 +137,7 @@ filemap_t fileMap; void splitPath(const std::string & path, std::string & dir, std::string & name) { -#if defined(MSVC_BUILD) +#if MSVC_BUILD char drive[_MAX_DRIVE]; char directory[_MAX_DIR]; char fname[_MAX_FNAME]; @@ -149,7 +156,8 @@ void splitPath(const std::string & path, std::string & dir, std::string & name) } -bool isFile(const std::string & fullName, unsigned char d_type) +#if !MSVC_BUILD +bool isFile(const std::string & fullName, unsigned int d_type) { #if defined(WIN32) || defined(__APPLE__) || defined(__FreeBSD__) #define REGULAR_FILE DT_REG @@ -169,12 +177,13 @@ bool isFile(const std::string & fullName, unsigned char d_type) } return false; } +#endif std::vector listDirectoryFiles(const std::string & dirName) { std::vector result; -#if defined (MSVC_BUILD) +#if MSVC_BUILD std::string searchName = dirName + "*"; // TRACE_SIMPGMSPACE("\tsearching for: %s", fileName.c_str()); WIN32_FIND_DATA ffd;