blob: d95132c0a5277eb54dd794790862233a81eaf572 [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"
Qingsi Wang2039ee72018-11-02 16:30:10 +000017#include "rtc_base/pathutils.h"
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020018
19namespace rtc {
20
21class UnixFilesystem : public FilesystemInterface {
22 public:
23 UnixFilesystem();
24 ~UnixFilesystem() override;
25
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020026 // This will attempt to delete the file located at filename.
27 // It will fail with VERIY if you pass it a non-existant file, or a directory.
Qingsi Wang2039ee72018-11-02 16:30:10 +000028 bool DeleteFile(const Pathname& filename) override;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020029
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020030 // This moves a file from old_path to new_path, where "file" can be a plain
31 // file or directory, which will be moved recursively.
32 // Returns true if function succeeds.
Qingsi Wang2039ee72018-11-02 16:30:10 +000033 bool MoveFile(const Pathname& old_path, const Pathname& new_path) override;
34
35 // Returns true if a pathname is a directory
36 bool IsFolder(const Pathname& pathname) override;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020037
38 // Returns true of pathname represents an existing file
Qingsi Wang2039ee72018-11-02 16:30:10 +000039 bool IsFile(const Pathname& pathname) override;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020040
Qingsi Wang2039ee72018-11-02 16:30:10 +000041 bool GetFileSize(const Pathname& path, size_t* size) override;
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020042};
43
44} // namespace rtc
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000045
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020046#endif // RTC_BASE_UNIXFILESYSTEM_H_