summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibFileSystemAccessClient/Client.h
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2022-12-16 23:15:12 +0100
committerSam Atkins <atkinssj@gmail.com>2023-01-07 10:53:43 +0000
commit2cbe2dd3c0cc9e783068419f4ba9a9798e87e1c7 (patch)
tree04f2a90a0e932a8c494c4eef1e24db20abcaedbd /Userland/Libraries/LibFileSystemAccessClient/Client.h
parent247db3fdd0e96b282f5ecb1c64da7bd533245611 (diff)
downloadserenity-2cbe2dd3c0cc9e783068419f4ba9a9798e87e1c7.zip
LibFileSystemAccessClient+CrashReporter: Introduce FSAC::File and use it
The new result returned just a file stream, which wasn't sufficient enough for most applications because it didn't provide a filename. This patch will make a new File object that has both a file stream and a filename.
Diffstat (limited to 'Userland/Libraries/LibFileSystemAccessClient/Client.h')
-rw-r--r--Userland/Libraries/LibFileSystemAccessClient/Client.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/Userland/Libraries/LibFileSystemAccessClient/Client.h b/Userland/Libraries/LibFileSystemAccessClient/Client.h
index 93e88aa24b..b0c0360f3b 100644
--- a/Userland/Libraries/LibFileSystemAccessClient/Client.h
+++ b/Userland/Libraries/LibFileSystemAccessClient/Client.h
@@ -8,6 +8,7 @@
#pragma once
#include <AK/HashMap.h>
+#include <AK/String.h>
#include <FileSystemAccessServer/FileSystemAccessClientEndpoint.h>
#include <FileSystemAccessServer/FileSystemAccessServerEndpoint.h>
#include <LibCore/File.h>
@@ -18,8 +19,26 @@
namespace FileSystemAccessClient {
+class Client;
+class File {
+public:
+ File(Badge<Client>, NonnullOwnPtr<Core::Stream::File> stream, String filename)
+ : m_stream(move(stream))
+ , m_filename(filename)
+ {
+ }
+
+ Core::Stream::File& stream() const { return *m_stream; }
+ NonnullOwnPtr<Core::Stream::File> release_stream() { return move(m_stream); }
+ String filename() const { return m_filename; }
+
+private:
+ NonnullOwnPtr<Core::Stream::File> m_stream;
+ String m_filename;
+};
+
using DeprecatedResult = ErrorOr<NonnullRefPtr<Core::File>>;
-using Result = ErrorOr<NonnullOwnPtr<Core::Stream::File>>;
+using Result = ErrorOr<File>;
class Client final
: public IPC::ConnectionToServer<FileSystemAccessClientEndpoint, FileSystemAccessServerEndpoint>