blob: 32af9b510a1216162b79ef26d505b8fe3a99fdb3 [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef RTC_BASE_UNIXFILESYSTEM_H_
12#define RTC_BASE_UNIXFILESYSTEM_H_
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000013
Yves Gerey988cc082018-10-23 12:03:01 +020014#include <stddef.h>
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000015
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "rtc_base/fileutils.h"
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020017
18namespace rtc {
19
20class UnixFilesystem : public FilesystemInterface {
21 public:
22 UnixFilesystem();
23 ~UnixFilesystem() override;
24
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020025 // This will attempt to delete the file located at filename.
26 // It will fail with VERIY if you pass it a non-existant file, or a directory.
Niels Möller6b9dec02018-11-02 08:50:21 +010027 bool DeleteFile(const std::string& filename) override;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020028
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020029 // This moves a file from old_path to new_path, where "file" can be a plain
30 // file or directory, which will be moved recursively.
31 // Returns true if function succeeds.
Niels Möller6b9dec02018-11-02 08:50:21 +010032 bool MoveFile(const std::string& old_path,
33 const std::string& new_path) override;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020034
35 // Returns true of pathname represents an existing file
Niels Möller6b9dec02018-11-02 08:50:21 +010036 bool IsFile(const std::string& pathname) override;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020037
Niels Möller6b9dec02018-11-02 08:50:21 +010038 bool GetFileSize(const std::string& path, size_t* size) override;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020039};
40
41} // namespace rtc
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000042
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020043#endif // RTC_BASE_UNIXFILESYSTEM_H_