summaryrefslogtreecommitdiff
path: root/Meta
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-10-29 13:58:19 -0400
committerLinus Groh <mail@linusgroh.de>2022-11-03 16:37:04 +0000
commitb820b9b2ffece9270619fc69102f3438b2ebb1fe (patch)
tree9fba81f8cd14c09b706fa69cde2eab722eb6bf63 /Meta
parent92f4f40198f515b809726aad51878fe41a14cc4d (diff)
downloadserenity-b820b9b2ffece9270619fc69102f3438b2ebb1fe.zip
LibUnicode: Make the generated .h and .cpp paths for emoji data optional
This is to allow people making emoji to run the generator to create the expected commit message format.
Diffstat (limited to 'Meta')
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp
index 012e8cc985..c568682769 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp
@@ -333,18 +333,25 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_option(emoji_resource_path, "Path to the /res/emoji directory", "emoji-resource-path", 'r', "emoji-resource-path");
args_parser.parse(arguments);
- auto generated_header_file = TRY(open_file(generated_header_path, Core::Stream::OpenMode::Write));
- auto generated_implementation_file = TRY(open_file(generated_implementation_path, Core::Stream::OpenMode::Write));
auto emoji_test_file = TRY(open_file(emoji_test_path, Core::Stream::OpenMode::Read));
- auto emoji_serenity_file = TRY(open_file(emoji_serenity_path, Core::Stream::OpenMode::Read));
- VERIFY(Core::Stream::File::exists(emoji_resource_path));
+ VERIFY(!emoji_resource_path.is_empty() && Core::Stream::File::exists(emoji_resource_path));
EmojiData emoji_data {};
TRY(parse_emoji_test_data(*emoji_test_file, emoji_data));
- TRY(parse_emoji_serenity_data(*emoji_serenity_file, emoji_data));
- TRY(generate_emoji_data_header(*generated_header_file, emoji_data));
- TRY(generate_emoji_data_implementation(*generated_implementation_file, emoji_data));
+ if (!emoji_serenity_path.is_empty()) {
+ auto emoji_serenity_file = TRY(open_file(emoji_serenity_path, Core::Stream::OpenMode::Read));
+ TRY(parse_emoji_serenity_data(*emoji_serenity_file, emoji_data));
+ }
+
+ if (!generated_header_path.is_empty()) {
+ auto generated_header_file = TRY(open_file(generated_header_path, Core::Stream::OpenMode::Write));
+ TRY(generate_emoji_data_header(*generated_header_file, emoji_data));
+ }
+ if (!generated_implementation_path.is_empty()) {
+ auto generated_implementation_file = TRY(open_file(generated_implementation_path, Core::Stream::OpenMode::Write));
+ TRY(generate_emoji_data_implementation(*generated_implementation_file, emoji_data));
+ }
if (!generated_installation_path.is_empty()) {
TRY(Core::Directory::create(LexicalPath { generated_installation_path }.parent(), Core::Directory::CreateDirectories::Yes));