bool IGCFileCleanup(unsigned current_year) { const auto pathname = GetPrimaryDataPath(); int numtries = 0; do { // Find out how much space is available unsigned long kbfree = FindFreeSpace(pathname.c_str()); if (kbfree >= LOGGER_MINFREESTORAGE) { // if enough space is available we return happily return true; } // if we don't have enough space yet we try to delete old IGC files if (!DeleteOldestIGCFile(current_year, pathname)) break; // but only 100 times numtries++; } while (numtries < 100); // if we get to this point we don't have any IGC files left or deleted // 100 old IGC files already return false; }
void StartupLogFreeRamAndStorage() { int freeram = SystemFreeRAM() / 1024; int freestorage = FindFreeSpace(GetPrimaryDataPath()); LogStartUp(_T("Free ram %d; free storage %d"), freeram, freestorage); }
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*/ }
void StartupLogFreeRamAndStorage() { #ifdef HAVE_MEM_INFO unsigned long freeram = SystemFreeRAM() / 1024; LogFormat("Free ram %lu KB", freeram); #endif unsigned long freestorage = FindFreeSpace(GetPrimaryDataPath()); LogFormat("Free storage %lu KB", freestorage); }
void SiteConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { buttonWaypoints = ((WndButton *)ConfigPanel::GetForm().FindByName(_T("cmdWaypoints"))); assert (buttonWaypoints); buttonWaypoints->SetOnClickNotify(OnWaypoints); WndProperty *wp = Add(_T(""), 0, true); wp->SetText(GetPrimaryDataPath()); wp->SetEnabled(false); AddFileReader(_("Map database"), _("The name of the file (.xcm) containing terrain, topography, and optionally " "waypoints, their details and airspaces."), szProfileMapFile, _T("*.xcm\0*.lkm\0")); AddFileReader(_("Waypoints"), _("Primary waypoints file. Supported file types are Cambridge/WinPilot files (.dat), " "Zander files (.wpz) or SeeYou files (.cup)."), szProfileWaypointFile, _T("*.dat\0*.xcw\0*.cup\0*.wpz\0*.wpt\0")); AddFileReader(_("More waypoints"), _("Secondary waypoints file. This may be used to add waypoints for a competition."), szProfileAdditionalWaypointFile, _T("*.dat\0*.xcw\0*.cup\0*.wpz\0*.wpt\0")); SetExpertRow(AdditionalWaypointFile); AddFileReader(_("Watched waypoints"), _("Waypoint file containing special waypoints for which additional computations like " "calculation of arrival height in map display always takes place. Useful for " "waypoints like known reliable thermal sources (e.g. powerplants) or mountain passes."), szProfileWatchedWaypointFile, _T("*.dat\0*.xcw\0*.cup\0*.wpz\0*.wpt\0")); SetExpertRow(WatchedWaypointFile); AddFileReader(_("Airspaces"), _("The file name of the primary airspace file."), szProfileAirspaceFile, _T("*.txt\0*.air\0*.sua\0")); AddFileReader(_("More airspaces"), _("The file name of the secondary airspace file."), szProfileAdditionalAirspaceFile, _T("*.txt\0*.air\0*.sua\0")); SetExpertRow(AdditionalAirspaceFile); AddFileReader(_("Terrain file"), _("The name of the file containing digital elevation terrain data."), szProfileTerrainFile, _T("*.jp2\0")); SetExpertRow(TerrainFile); AddFileReader(_("Topography file"), _("Specifies the file defining the topographical features."), szProfileTopographyFile, _T("*.tpl\0")); SetExpertRow(TopographyFile); AddFileReader(_("Waypoint details"), _("The file may contain extracts from enroute supplements or other contributed " "information about individual waypoints and airfields."), szProfileAirfieldFile, _T("*.txt\0")); SetExpertRow(AirfieldFile); }
void SiteConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { WndProperty *wp = Add(_T(""), 0, true); wp->SetText(GetPrimaryDataPath().c_str()); wp->SetEnabled(false); AddFile(_("Map database"), _("The name of the file (.xcm) containing terrain, topography, and optionally " "waypoints, their details and airspaces."), ProfileKeys::MapFile, _T("*.xcm\0*.lkm\0"), FileType::MAP); AddFile(_("Waypoints"), _("Primary waypoints file. Supported file types are Cambridge/WinPilot files (.dat), " "Zander files (.wpz) or SeeYou files (.cup)."), ProfileKeys::WaypointFile, WAYPOINT_FILE_PATTERNS, FileType::WAYPOINT); AddFile(_("More waypoints"), _("Secondary waypoints file. This may be used to add waypoints for a competition."), ProfileKeys::AdditionalWaypointFile, WAYPOINT_FILE_PATTERNS, FileType::WAYPOINT); SetExpertRow(AdditionalWaypointFile); AddFile(_("Watched waypoints"), _("Waypoint file containing special waypoints for which additional computations like " "calculation of arrival height in map display always takes place. Useful for " "waypoints like known reliable thermal sources (e.g. powerplants) or mountain passes."), ProfileKeys::WatchedWaypointFile, WAYPOINT_FILE_PATTERNS, FileType::WAYPOINT); SetExpertRow(WatchedWaypointFile); AddFile(_("Airspaces"), _("The file name of the primary airspace file."), ProfileKeys::AirspaceFile, _T("*.txt\0*.air\0*.sua\0"), FileType::AIRSPACE); AddFile(_("More airspaces"), _("The file name of the secondary airspace file."), ProfileKeys::AdditionalAirspaceFile, _T("*.txt\0*.air\0*.sua\0"), FileType::AIRSPACE); SetExpertRow(AdditionalAirspaceFile); AddFile(_("Waypoint details"), _("The file may contain extracts from enroute supplements or other contributed " "information about individual waypoints and airfields."), ProfileKeys::AirfieldFile, _T("*.txt\0")); SetExpertRow(AirfieldFile); }