diff --git a/api/config.md b/api/config.md index 96fd2c5321..0186439dfa 100644 --- a/api/config.md +++ b/api/config.md @@ -67,7 +67,7 @@ flags | | Advanced Compiler Settings for debug purposes (ie C++ compiler -g, e Key | Default Value | Description :--- | :--- | :--- -bundle_identifier | | A unique ID that identifies the bundle (used by all app stores). It's required when `[meta] type` is not `"extension"`. +bundle_identifier | | A unique ID that identifies the bundle (used by all app stores). It's required when `[meta] type` is not `"extension"`. It should be in a reverse DNS notation https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleidentifier#discussion copyright | | A string that gets used in the about dialog and package meta info. description | | A short description of the app. file_limit | | Set the limit of files that can be opened by your process. diff --git a/src/cli/cli.cc b/src/cli/cli.cc index 0dcd49c647..f131fc42d5 100644 --- a/src/cli/cli.cc +++ b/src/cli/cli.cc @@ -2413,9 +2413,19 @@ int main (const int argc, const char* argv[]) { createSubcommand("build", buildOptions, true, [&](Map optionsWithValue, std::unordered_set optionsWithoutValue) -> void { auto isForExtensionOnly = settings["meta_type"] == "extension" || settings["build_type"] == "extension"; - if (settings["meta_bundle_identifier"].size() == 0 !isForExtensionOnly) { - log("ERROR: [meta] bundle_identifier option is empty"); - exit(1); + if (!isForExtensionOnly) { + if (settings["meta_bundle_identifier"].size() == 0) { + log("ERROR: [meta] bundle_identifier option is empty"); + exit(1); + } + + std::regex reverseDnsPattern(R"(^[a-z0-9]+([-a-z0-9]*[a-z0-9]+)?(\.[a-z0-9]+([-a-z0-9]*[a-z0-9]+)?)*$)", std::regex::icase); + if (!std::regex_match(settings["meta_bundle_identifier"], reverseDnsPattern)) { + log("ERROR: [meta] bundle_name has invalid format :" + settings["meta_bundle_identifier"]); + log("Please use reverse DNS notation (https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleidentifier#discussion)"); + exit(1); + } + } String argvForward = ""; diff --git a/src/cli/templates.hh b/src/cli/templates.hh index 7aa988e1b7..9d40c0f7c7 100644 --- a/src/cli/templates.hh +++ b/src/cli/templates.hh @@ -1429,7 +1429,9 @@ flags = "-g" [meta] -; A unique ID that identifies the bundle (used by all app stores). It's required when `[meta] type` is not `"extension"`. +; A unique ID that identifies the bundle (used by all app stores). +; It's required when `[meta] type` is not `"extension"`. +; It should be in a reverse DNS notation https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleidentifier#discussion bundle_identifier = "com.beepboop" ; A string that gets used in the about dialog and package meta info.