🧹 tui: refactor to use utils::contains

This commit is contained in:
Vladislav Nepogodin 2024-07-14 02:37:48 +04:00
parent c0360efac7
commit e81e45b3bd
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9

View File

@ -1094,7 +1094,7 @@ void make_swap() noexcept {
#endif
// Since a partition was used, remove that partition from the list
std::erase_if(partitions, [partition](std::string_view x) { return x.find(partition) != std::string_view::npos; });
std::erase_if(partitions, [partition](std::string_view x) { return gucc::utils::contains(x, partition); });
number_partitions -= 1;
}
@ -1238,7 +1238,7 @@ bool zfs_create_zpool(bool do_create_zpool = true) noexcept {
}
for (auto&& invalid_keyword : {"log", "mirror", "raidz", "raidz1", "raidz2", "spare"}) {
if (zfs_zpool_name.find(invalid_keyword) != std::string::npos) {
if (gucc::utils::contains(zfs_zpool_name, invalid_keyword)) {
zfs_menu_text = zfs_zpoolcvalidation2;
break;
}
@ -1851,7 +1851,7 @@ void mount_partitions() noexcept {
mount_dev = std::move(value);
// loop while the mountpoint specified is incorrect (is only '/', is blank, or has spaces).
while ((mount_dev.size() <= 1) || (mount_dev[0] != '/') || (mount_dev.find_first_of(" ") != std::string::npos)) {
while ((mount_dev.size() <= 1) || (mount_dev[0] != '/') || gucc::utils::contains(mount_dev, " ")) {
// Warn user about naming convention
detail::msgbox_widget("\nPartition cannot be mounted due to a problem with the mountpoint name.\nA name must be given after a forward slash.\n");
// Ask user for mountpoint again