aboutsummaryrefslogtreecommitdiff
path: root/bpkg/rep-create.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-07-22 12:43:22 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-07-23 20:06:50 +0300
commit1d9f410810de6fbb9c974735e5e14dbebe1c0718 (patch)
treef44b04d9e0a13a21deb7f59f1a2ae8334daf7f94 /bpkg/rep-create.cxx
parent7ea82c5013ab3c3d44b4b85cf767559e7019854f (diff)
Adapt to fdstream extension
Diffstat (limited to 'bpkg/rep-create.cxx')
-rw-r--r--bpkg/rep-create.cxx17
1 files changed, 7 insertions, 10 deletions
diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx
index 61e3f81..16da164 100644
--- a/bpkg/rep-create.cxx
+++ b/bpkg/rep-create.cxx
@@ -5,9 +5,9 @@
#include <bpkg/rep-create>
#include <map>
-#include <fstream>
#include <iostream>
+#include <butl/fdstream>
#include <butl/filesystem> // dir_iterator
#include <bpkg/manifest>
@@ -217,17 +217,15 @@ namespace bpkg
try
{
{
- ofstream ofs;
- ofs.exceptions (ofstream::badbit | ofstream::failbit);
-
// While we can do nothing about repositories files edited on Windows
// and littered with the carriage return characters, there is no
// reason to litter the auto-generated packages and signature files.
//
- ofs.open (p.string (), ofstream::out | ofstream::binary);
+ ofdstream ofs (p, ios::binary);
manifest_serializer s (ofs, p.string ());
manifests.serialize (s);
+ ofs.close ();
}
const optional<string>& cert (rms.back ().certificate);
@@ -245,12 +243,11 @@ namespace bpkg
p = path (d / signature);
- ofstream ofs;
- ofs.exceptions (ofstream::badbit | ofstream::failbit);
- ofs.open (p.string (), ofstream::out | ofstream::binary);
+ ofdstream ofs (p, ios::binary);
manifest_serializer s (ofs, p.string ());
m.serialize (s);
+ ofs.close ();
}
else
{
@@ -266,9 +263,9 @@ namespace bpkg
{
fail << "unable to save manifest: " << e.description;
}
- catch (const ofstream::failure&)
+ catch (const ofdstream::failure& e)
{
- fail << "unable to write to " << p;
+ fail << "unable to write to " << p << ": " << e.what ();
}
if (verb)