diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-04-21 11:20:42 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-04-21 11:20:42 +0200 |
commit | fb4e3c1b4c2aae6fd8a44e7727e6f73aa4db2ca8 (patch) | |
tree | e1d03d879570a56ebf118b231828ce4929d21ac9 | |
parent | 87690881f2e0104208ed5f2e78bd2af50d84b67b (diff) |
Add blank line between packages.manifest entries in bdep-new
-rw-r--r-- | bdep/new.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bdep/new.cxx b/bdep/new.cxx index 753b8f3..2c954fc 100644 --- a/bdep/new.cxx +++ b/bdep/new.cxx @@ -3220,10 +3220,16 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args) bool e (exists (f)); try { + // Note: add an extra newline if appending to an existing file. While + // this will normally result in an extra blank line between entries + // which we don't really need, it will also make sure we don't generate + // invalid file if there is no newline at the end of file (which can + // happen if the file was edited manually). + // ofdstream os (f, (fdopen_mode::out | fdopen_mode::create | fdopen_mode::append)); - os << (e ? ":" : ": 1") << '\n' + os << (e ? "\n:" : ": 1") << '\n' << "location: " << pkg->posix_representation () << '\n'; os.close (); } |