aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs/io
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-01-14 19:43:19 +0100
committerMax Kellermann <max@duempel.org>2015-01-14 19:44:28 +0100
commiteaf0662b75e8e074dbfe950aa9f408e4ad806bcc (patch)
tree0af65761fd7c14fe61e4b16a2b9e56f8a32ca79e /src/fs/io
parent6e8ea2a2cb655f805906a1930b86c20486aef2cf (diff)
downloadmpd-eaf0662b75e8e074dbfe950aa9f408e4ad806bcc.tar.gz
mpd-eaf0662b75e8e074dbfe950aa9f408e4ad806bcc.tar.xz
mpd-eaf0662b75e8e074dbfe950aa9f408e4ad806bcc.zip
fs/io/FileOutputStream: add static method Create()
Diffstat (limited to 'src/fs/io')
-rw-r--r--src/fs/io/FileOutputStream.cxx12
-rw-r--r--src/fs/io/FileOutputStream.hxx1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/fs/io/FileOutputStream.cxx b/src/fs/io/FileOutputStream.cxx
index 7a6416557..11b5b2351 100644
--- a/src/fs/io/FileOutputStream.cxx
+++ b/src/fs/io/FileOutputStream.cxx
@@ -22,6 +22,18 @@
#include "fs/FileSystem.hxx"
#include "util/Error.hxx"
+FileOutputStream *
+FileOutputStream::Create(Path path, Error &error)
+{
+ FileOutputStream *f = new FileOutputStream(path, error);
+ if (!f->IsDefined()) {
+ delete f;
+ f = nullptr;
+ }
+
+ return f;
+}
+
#ifdef WIN32
FileOutputStream::FileOutputStream(Path _path, Error &error)
diff --git a/src/fs/io/FileOutputStream.hxx b/src/fs/io/FileOutputStream.hxx
index 03d062134..f66554ec9 100644
--- a/src/fs/io/FileOutputStream.hxx
+++ b/src/fs/io/FileOutputStream.hxx
@@ -58,6 +58,7 @@ public:
Cancel();
}
+ static FileOutputStream *Create(Path path, Error &error);
bool IsDefined() const {
#ifdef WIN32