mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Support empty package names in filewrapper tool
PiperOrigin-RevId: 259943587 Change-Id: I14d95dcd7d839903ebd12f4032e05e29bca17204
This commit is contained in:
parent
1b93745d00
commit
db0ebe3650
|
@ -150,9 +150,9 @@ constexpr const char kHFileFooterFmt[] =
|
|||
|
||||
// Format literals for generating the .cc file out of the input files.
|
||||
constexpr const char kCcFileHeaderFmt[] =
|
||||
R"(// Automatically generated by sapi_cc_embed_data() Bazel rule
|
||||
R"(// Automatically generated by sapi_cc_embed_data() build rule
|
||||
|
||||
#include "%s/%s.h"
|
||||
#include "%s.h"
|
||||
|
||||
#include "absl/base/macros.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
|
@ -198,7 +198,7 @@ int main(int argc, char* argv[]) {
|
|||
// We're not aiming for human usability here, as this tool is always run as
|
||||
// part of the build.
|
||||
absl::FPrintF(stderr,
|
||||
"%s PACKAGE NAME NAMESPACE OUTPUT_H OUTPUT_CC INPUT...",
|
||||
"%s PACKAGE NAME NAMESPACE OUTPUT_H OUTPUT_CC INPUT...\n",
|
||||
argv[0]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -238,7 +238,12 @@ int main(int argc, char* argv[]) {
|
|||
File out_cc(*arg++, "wb");
|
||||
--argc;
|
||||
|
||||
absl::FPrintF(out_cc.get(), kCcFileHeaderFmt, package, name);
|
||||
std::string package_name = package;
|
||||
if (!package_name.empty()) {
|
||||
absl::StrAppend(&package_name, "/");
|
||||
}
|
||||
absl::StrAppend(&package_name, name);
|
||||
absl::FPrintF(out_cc.get(), kCcFileHeaderFmt, package_name);
|
||||
if (have_ns) {
|
||||
absl::FPrintF(out_cc.get(), kCcNamespaceBeginFmt, ns);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user