void VisitDataFiles(const TCHAR* filter, File::Visitor &visitor) { const TCHAR *data_path = GetPrimaryDataPath(); Directory::VisitSpecificFiles(data_path, filter, visitor, true); { TCHAR buffer[MAX_PATH]; const TCHAR *home_path = GetHomeDataPath(buffer); if (home_path != NULL && _tcscmp(data_path, home_path) != 0) Directory::VisitSpecificFiles(home_path, filter, visitor, true); } #if defined(_WIN32_WCE) && !defined(GNAV) TCHAR FlashPath[MAX_PATH]; FlashCardEnumerator enumerator; const TCHAR *name; while ((name = enumerator.next()) != NULL) { _stprintf(FlashPath, _T(DIR_SEPARATOR_S"%s"DIR_SEPARATOR_S"%s"), name, XCSDATADIR); if (_tcscmp(data_path, FlashPath) == 0) /* don't scan primary data path twice */ continue; Directory::VisitSpecificFiles(FlashPath, filter, visitor, true); } #endif /* _WIN32_WCE && !GNAV*/ }
static TCHAR * FindDataPath() { if (is_altair() && is_embedded()) /* hard-coded path for Altair */ return _tcsdup(_T("\\NOR Flash")); if (is_android()) { /* XXX use Environment.getExternalStorageDirectory() */ #ifdef ANDROID /* hack for Samsung Galaxy S and Samsung Galaxy Tab (which has a build-in and an external SD card) */ struct stat st; if (stat("/sdcard/external_sd", &st) == 0 && (st.st_mode & S_IFDIR) != 0 && fgrep("/proc/mounts", "/sdcard/external_sd ")) return strdup("/sdcard/external_sd/XCSoarData"); #endif /* hard-coded path for Android */ return _tcsdup(_T("/sdcard/XCSoarData")); } #ifdef _WIN32_WCE /* if XCSoar was started from a flash disk, put the XCSoarData onto it, too */ { TCHAR buffer[MAX_PATH]; if (ModuleInFlash(NULL, buffer) != NULL) { _tcscat(buffer, _T(DIR_SEPARATOR_S)); _tcscat(buffer, XCSDATADIR); if (Directory::Exists(buffer)) return _tcsdup(buffer); } /* if a flash disk with XCSoarData exists, use it */ if (ExistingDataOnFlash(buffer) != NULL) return _tcsdup(buffer); } #endif { TCHAR buffer[MAX_PATH]; const TCHAR *path = GetHomeDataPath(buffer); if (path != NULL) return _tcsdup(path); } return NULL; }
static TCHAR * FindDataPath() { if (is_altair()) /* hard-coded path for Altair */ return _tcsdup(_T("\\NOR Flash")); if (is_android()) /* hard-coded path for Android */ return _tcsdup(_T("/sdcard/XCSoarData")); #ifdef _WIN32_WCE /* if XCSoar was started from a flash disk, put the XCSoarData onto it, too */ { TCHAR buffer[MAX_PATH]; if (ModuleInFlash(NULL, buffer) != NULL) { _tcscat(buffer, _T(DIR_SEPARATOR_S)); _tcscat(buffer, XCSDATADIR); if (Directory::Exists(buffer)) return _tcsdup(buffer); } /* if a flash disk with XCSoarData exists, use it */ if (ExistingDataOnFlash(buffer) != NULL) return _tcsdup(buffer); } #endif { TCHAR buffer[MAX_PATH]; const TCHAR *path = GetHomeDataPath(buffer); if (path != NULL) return _tcsdup(path); } return NULL; }