| Index: webrtc/base/file.cc
|
| diff --git a/webrtc/base/file.cc b/webrtc/base/file.cc
|
| index 74d48177e4b976ff27689e3e79c5a76f140beceb..8b5df9e9be4f74ae31cac62ff80aa340323bfad5 100644
|
| --- a/webrtc/base/file.cc
|
| +++ b/webrtc/base/file.cc
|
| @@ -10,8 +10,19 @@
|
|
|
| #include "webrtc/base/file.h"
|
|
|
| +#include <utility>
|
| +
|
| namespace rtc {
|
|
|
| +namespace {
|
| +
|
| +std::string NormalizePathname(Pathname&& path) {
|
| + path.Normalize();
|
| + return path.pathname();
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| File::File(PlatformFile file) : file_(file) {}
|
|
|
| File::File() : file_(kInvalidPlatformFileValue) {}
|
| @@ -20,14 +31,36 @@ File::~File() {
|
| Close();
|
| }
|
|
|
| +// static
|
| File File::Open(const std::string& path) {
|
| return File(OpenPlatformFile(path));
|
| }
|
|
|
| +// static
|
| +File File::Open(Pathname&& path) {
|
| + return Open(NormalizePathname(std::move(path)));
|
| +}
|
| +
|
| +// static
|
| +File File::Open(const Pathname& path) {
|
| + return Open(Pathname(path));
|
| +}
|
| +
|
| +// static
|
| File File::Create(const std::string& path) {
|
| return File(CreatePlatformFile(path));
|
| }
|
|
|
| +// static
|
| +File File::Create(Pathname&& path) {
|
| + return Create(NormalizePathname(std::move(path)));
|
| +}
|
| +
|
| +// static
|
| +File File::Create(const Pathname& path) {
|
| + return Create(Pathname(path));
|
| +}
|
| +
|
| File::File(File&& other) : file_(other.file_) {
|
| other.file_ = kInvalidPlatformFileValue;
|
| }
|
|
|