diff options
author | Ralf Donau <ruelle@volleyballschlaeger.de> | 2022-04-24 16:09:19 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-04-25 10:47:56 +0200 |
commit | 69a896cb823f117344a5b4ba22191cd35ee8cb2c (patch) | |
tree | 54d0d0593997c0c4365479907733624264c536fe /Userland/Utilities/ini.cpp | |
parent | 86d4b7ebfcaa86590522a4187ff51a467ef27008 (diff) | |
download | serenity-69a896cb823f117344a5b4ba22191cd35ee8cb2c.zip |
ini: Use String for arguments
Diffstat (limited to 'Userland/Utilities/ini.cpp')
-rw-r--r-- | Userland/Utilities/ini.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Utilities/ini.cpp b/Userland/Utilities/ini.cpp index ae152a83fc..b74f9b2f62 100644 --- a/Userland/Utilities/ini.cpp +++ b/Userland/Utilities/ini.cpp @@ -14,10 +14,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio rpath wpath cpath")); - char const* path = nullptr; - char const* group = nullptr; - char const* key = nullptr; - char const* value_to_write = nullptr; + StringView path; + String group; + String key; + String value_to_write; Core::ArgsParser args_parser; args_parser.add_positional_argument(path, "Path to INI file", "path"); @@ -31,9 +31,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) return 1; } - auto config = TRY(Core::ConfigFile::open(path, value_to_write ? Core::ConfigFile::AllowWriting::Yes : Core::ConfigFile::AllowWriting::No)); + auto config = TRY(Core::ConfigFile::open(path, value_to_write.is_null() ? Core::ConfigFile::AllowWriting::No : Core::ConfigFile::AllowWriting::Yes)); - if (value_to_write) { + if (!value_to_write.is_null()) { config->write_entry(group, key, value_to_write); TRY(config->sync()); return 0; |