aboutsummaryrefslogtreecommitdiff
path: root/launcher/FileSystem.h
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-04-03 17:14:06 -0700
committerRachel Powers <508861+Ryex@users.noreply.github.com>2023-04-03 17:14:06 -0700
commit5b50b806ec5954aa3822443969d22ea79faa07c5 (patch)
treea66ade07315680fbd2d433e0a71fca1099f5b0a7 /launcher/FileSystem.h
parent538092b72728fa34bafc873e16abaa7f318a945c (diff)
downloadPrismLauncher-5b50b806ec5954aa3822443969d22ea79faa07c5.tar.gz
PrismLauncher-5b50b806ec5954aa3822443969d22ea79faa07c5.tar.bz2
PrismLauncher-5b50b806ec5954aa3822443969d22ea79faa07c5.zip
refactor: remove data duplication in statis FS Names
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher/FileSystem.h')
-rw-r--r--launcher/FileSystem.h70
1 files changed, 18 insertions, 52 deletions
diff --git a/launcher/FileSystem.h b/launcher/FileSystem.h
index 47044d93..cb581d0c 100644
--- a/launcher/FileSystem.h
+++ b/launcher/FileSystem.h
@@ -360,58 +360,24 @@ enum class FilesystemType {
* QMap is ordered
*
*/
-static const QMap<FilesystemType, QString> s_filesystem_type_names = {
- {FilesystemType::FAT, QStringLiteral("FAT")},
- {FilesystemType::NTFS, QStringLiteral("NTFS")},
- {FilesystemType::REFS, QStringLiteral("REFS")},
- {FilesystemType::EXT, QStringLiteral("EXT")},
- {FilesystemType::EXT_2_OLD, QStringLiteral("EXT_2_OLD")},
- {FilesystemType::EXT_2_3_4, QStringLiteral("EXT2/3/4")},
- {FilesystemType::XFS, QStringLiteral("XFS")},
- {FilesystemType::BTRFS, QStringLiteral("BTRFS")},
- {FilesystemType::NFS, QStringLiteral("NFS")},
- {FilesystemType::ZFS, QStringLiteral("ZFS")},
- {FilesystemType::APFS, QStringLiteral("APFS")},
- {FilesystemType::HFS, QStringLiteral("HFS")},
- {FilesystemType::HFSPLUS, QStringLiteral("HFSPLUS")},
- {FilesystemType::HFSX, QStringLiteral("HFSX")},
- {FilesystemType::FUSEBLK, QStringLiteral("FUSEBLK")},
- {FilesystemType::F2FS, QStringLiteral("F2FS")},
- {FilesystemType::UNKNOWN, QStringLiteral("UNKNOWN")}
-};
-
-
-/**
- * @brief Ordered Mapping of reported filesystem names to enum types
- * this mapping is non exsaustive, it just attempts to capture the many way these filesystems could be reported.
- * all keys are in uppercase, use `QString.toUpper()` or equivalent during lookup.
- *
- * QMap is ordered
- *
- */
-static const QMap<QString, FilesystemType> s_filesystem_type_names_inverse = {
- {QStringLiteral("FAT"), FilesystemType::FAT},
- {QStringLiteral("NTFS"), FilesystemType::NTFS},
- {QStringLiteral("REFS"), FilesystemType::REFS},
- {QStringLiteral("EXT2_OLD"), FilesystemType::EXT_2_OLD},
- {QStringLiteral("EXT_2_OLD"), FilesystemType::EXT_2_OLD},
- {QStringLiteral("EXT2"), FilesystemType::EXT_2_3_4},
- {QStringLiteral("EXT3"), FilesystemType::EXT_2_3_4},
- {QStringLiteral("EXT4"), FilesystemType::EXT_2_3_4},
- {QStringLiteral("EXT2/3/4"), FilesystemType::EXT_2_3_4},
- {QStringLiteral("EXT_2_3_4"), FilesystemType::EXT_2_3_4},
- {QStringLiteral("EXT"), FilesystemType::EXT}, // must come after all other EXT variants to prevent greedy detection
- {QStringLiteral("XFS"), FilesystemType::XFS},
- {QStringLiteral("BTRFS"), FilesystemType::BTRFS},
- {QStringLiteral("NFS"), FilesystemType::NFS},
- {QStringLiteral("ZFS"), FilesystemType::ZFS},
- {QStringLiteral("APFS"), FilesystemType::APFS},
- {QStringLiteral("HFSPLUS"), FilesystemType::HFSPLUS},
- {QStringLiteral("HFSX"), FilesystemType::HFSX},
- {QStringLiteral("HFS"), FilesystemType::HFS},
- {QStringLiteral("FUSEBLK"), FilesystemType::FUSEBLK},
- {QStringLiteral("F2FS"), FilesystemType::F2FS},
- {QStringLiteral("UNKNOWN"), FilesystemType::UNKNOWN}
+static const QMap<FilesystemType, QStringList> s_filesystem_type_names = {
+ {FilesystemType::FAT, { "FAT" }},
+ {FilesystemType::NTFS, { "NTFS" }},
+ {FilesystemType::REFS, { "REFS" }},
+ {FilesystemType::EXT_2_OLD, { "EXT_2_OLD", "EXT2_OLD" }},
+ {FilesystemType::EXT_2_3_4, { "EXT2/3/4", "EXT_2_3_4", "EXT2", "EXT3", "EXT4" }},
+ {FilesystemType::EXT, { "EXT" }},
+ {FilesystemType::XFS, { "XFS" }},
+ {FilesystemType::BTRFS, { "BTRFS" }},
+ {FilesystemType::NFS, { "NFS" }},
+ {FilesystemType::ZFS, { "ZFS" }},
+ {FilesystemType::APFS, { "APFS" }},
+ {FilesystemType::HFS, { "HFS" }},
+ {FilesystemType::HFSPLUS, { "HFSPLUS" }},
+ {FilesystemType::HFSX, { "HFSX" }},
+ {FilesystemType::FUSEBLK, { "FUSEBLK" }},
+ {FilesystemType::F2FS, { "F2FS" }},
+ {FilesystemType::UNKNOWN, { "UNKNOWN" }}
};
/**