From 4c8c67b8b5e3bc823c0dfe4e4bd66a775b0edf21 Mon Sep 17 00:00:00 2001 From: Sadie del Solar Date: Wed, 1 May 2024 13:51:30 -0700 Subject: [PATCH] Cleanup: Adjust comments for the Subdirectory enum --- src/fileio.cpp | 33 +++++++++++++++--------------- src/fileio_type.h | 52 +++++++++++++++++++++++------------------------ 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/src/fileio.cpp b/src/fileio.cpp index c99ec88bc1..9811180a23 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -38,23 +38,24 @@ extern std::string _config_file; extern std::string _highscore_file; static const char * const _subdirs[] = { - "", - "save" PATHSEP, - "save" PATHSEP "autosave" PATHSEP, - "scenario" PATHSEP, - "scenario" PATHSEP "heightmap" PATHSEP, - "gm" PATHSEP, - "data" PATHSEP, - "baseset" PATHSEP, - "newgrf" PATHSEP, - "lang" PATHSEP, - "ai" PATHSEP, - "ai" PATHSEP "library" PATHSEP, - "game" PATHSEP, - "game" PATHSEP "library" PATHSEP, - "screenshot" PATHSEP, - "social_integration" PATHSEP, + "", ///< BASE_DIR + "save" PATHSEP, ///< SAVE_DIR + "save" PATHSEP "autosave" PATHSEP, ///< AUTOSAVE_DIR + "scenario" PATHSEP, ///< SCENARIO_DIR + "scenario" PATHSEP "heightmap" PATHSEP, ///< HEIGHTMAP_DIR + "gm" PATHSEP, ///< OLD_GM_DIR + "data" PATHSEP, ///< OLD_DATA_DIR + "baseset" PATHSEP, ///< BASESET_DIR + "newgrf" PATHSEP, ///< NEWGRF_DIR + "lang" PATHSEP, ///< LANG_DIR + "ai" PATHSEP, ///< AI_DIR + "ai" PATHSEP "library" PATHSEP, ///< AI_LIBRARY_DIR + "game" PATHSEP, ///< GAME_DIR + "game" PATHSEP "library" PATHSEP, ///< GAME_LIBRARY_DIR + "screenshot" PATHSEP, ///< SCREENSHOT_DIR + "social_integration" PATHSEP, ///< SOCIAL_INTEGRATION_DIR }; +// This should line up with the "Subdirectory" enum defined in fileio_type.h static_assert(lengthof(_subdirs) == NUM_SUBDIRS); /** diff --git a/src/fileio_type.h b/src/fileio_type.h index e5955fb90a..5c5b76a3db 100644 --- a/src/fileio_type.h +++ b/src/fileio_type.h @@ -109,24 +109,24 @@ inline DetailedFileType GetDetailedFileType(FiosType fios_type) * The different kinds of subdirectories OpenTTD uses */ enum Subdirectory { - BASE_DIR, ///< Base directory for all subdirectories - SAVE_DIR, ///< Base directory for all savegames - AUTOSAVE_DIR, ///< Subdirectory of save for autosaves - SCENARIO_DIR, ///< Base directory for all scenarios - HEIGHTMAP_DIR, ///< Subdirectory of scenario for heightmaps - OLD_GM_DIR, ///< Old subdirectory for the music - OLD_DATA_DIR, ///< Old subdirectory for the data. - BASESET_DIR, ///< Subdirectory for all base data (base sets, intro game) - NEWGRF_DIR, ///< Subdirectory for all NewGRFs - LANG_DIR, ///< Subdirectory for all translation files - AI_DIR, ///< Subdirectory for all %AI files - AI_LIBRARY_DIR,///< Subdirectory for all %AI libraries - GAME_DIR, ///< Subdirectory for all game scripts - GAME_LIBRARY_DIR, ///< Subdirectory for all GS libraries - SCREENSHOT_DIR, ///< Subdirectory for all screenshots + BASE_DIR, ///< Base directory for all subdirectories + SAVE_DIR, ///< Base directory for all savegames + AUTOSAVE_DIR, ///< Subdirectory of save for autosaves + SCENARIO_DIR, ///< Base directory for all scenarios + HEIGHTMAP_DIR, ///< Subdirectory of scenario for heightmaps + OLD_GM_DIR, ///< Old subdirectory for the music + OLD_DATA_DIR, ///< Old subdirectory for the data. + BASESET_DIR, ///< Subdirectory for all base data (base sets, intro game) + NEWGRF_DIR, ///< Subdirectory for all NewGRFs + LANG_DIR, ///< Subdirectory for all translation files + AI_DIR, ///< Subdirectory for all %AI files + AI_LIBRARY_DIR, ///< Subdirectory for all %AI libraries + GAME_DIR, ///< Subdirectory for all game scripts + GAME_LIBRARY_DIR, ///< Subdirectory for all GS libraries + SCREENSHOT_DIR, ///< Subdirectory for all screenshots SOCIAL_INTEGRATION_DIR, ///< Subdirectory for all social integration plugins - NUM_SUBDIRS, ///< Number of subdirectories - NO_DIRECTORY, ///< A path without any base directory + NUM_SUBDIRS, ///< Number of subdirectories + NO_DIRECTORY, ///< A path without any base directory }; /** @@ -134,17 +134,17 @@ enum Subdirectory { */ enum Searchpath : unsigned { SP_FIRST_DIR, - SP_WORKING_DIR = SP_FIRST_DIR, ///< Search in the working directory + SP_WORKING_DIR = SP_FIRST_DIR, ///< Search in the working directory #ifdef USE_XDG - SP_PERSONAL_DIR_XDG, ///< Search in the personal directory from the XDG specification + SP_PERSONAL_DIR_XDG, ///< Search in the personal directory from the XDG specification #endif - SP_PERSONAL_DIR, ///< Search in the personal directory - SP_SHARED_DIR, ///< Search in the shared directory, like 'Shared Files' under Windows - SP_BINARY_DIR, ///< Search in the directory where the binary resides - SP_INSTALLATION_DIR, ///< Search in the installation directory - SP_APPLICATION_BUNDLE_DIR, ///< Search within the application bundle - SP_AUTODOWNLOAD_DIR, ///< Search within the autodownload directory - SP_AUTODOWNLOAD_PERSONAL_DIR, ///< Search within the autodownload directory located in the personal directory + SP_PERSONAL_DIR, ///< Search in the personal directory + SP_SHARED_DIR, ///< Search in the shared directory, like 'Shared Files' under Windows + SP_BINARY_DIR, ///< Search in the directory where the binary resides + SP_INSTALLATION_DIR, ///< Search in the installation directory + SP_APPLICATION_BUNDLE_DIR, ///< Search within the application bundle + SP_AUTODOWNLOAD_DIR, ///< Search within the autodownload directory + SP_AUTODOWNLOAD_PERSONAL_DIR, ///< Search within the autodownload directory located in the personal directory SP_AUTODOWNLOAD_PERSONAL_DIR_XDG, ///< Search within the autodownload directory located in the personal directory (XDG variant) NUM_SEARCHPATHS };