| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 #ifdef _WIN32 | 23 #ifdef _WIN32 |
| 24 #define PATH_SEPARATOR '\\' | 24 #define PATH_SEPARATOR '\\' |
| 25 #else | 25 #else |
| 26 #define PATH_SEPARATOR '/' | 26 #define PATH_SEPARATOR '/' |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 namespace AdblockPlus | 29 namespace AdblockPlus |
| 30 { | 30 { |
| 31 /** | 31 /** |
| 32 * `FileSystem` implementation that interacts directly with the operating | 32 * `FileSystem` implementation that interacts directly with the operating |
| 33 * system's file system. | 33 * system's file system. |
|
Wladimir Palant
2014/08/29 18:42:27
"All paths are considered relative to the base pat
Felix Dahlke
2014/09/01 17:00:15
Done.
| |
| 34 * All paths are considered relative to the base path, or to the current | |
| 35 * working directory if no base path is set (see `SetBasePath()`). | |
| 34 */ | 36 */ |
| 35 class DefaultFileSystem : public FileSystem | 37 class DefaultFileSystem : public FileSystem |
| 36 { | 38 { |
| 37 public: | 39 public: |
| 38 std::tr1::shared_ptr<std::istream> Read(const std::string& path) const; | 40 std::tr1::shared_ptr<std::istream> Read(const std::string& path) const; |
| 39 void Write(const std::string& path, | 41 void Write(const std::string& path, |
| 40 std::tr1::shared_ptr<std::istream> data); | 42 std::tr1::shared_ptr<std::istream> data); |
| 41 void Move(const std::string& fromPath, | 43 void Move(const std::string& fromPath, |
| 42 const std::string& toPath); | 44 const std::string& toPath); |
| 43 void Remove(const std::string& path); | 45 void Remove(const std::string& path); |
| 44 StatResult Stat(const std::string& path) const; | 46 StatResult Stat(const std::string& path) const; |
| 45 std::string Resolve(const std::string& path) const; | 47 std::string Resolve(const std::string& path) const; |
| 48 | |
| 49 /** | |
| 50 * Sets the base path, all paths are considered relative to it. | |
| 51 * @param path Base path. | |
| 52 */ | |
| 46 void SetBasePath(const std::string& path); | 53 void SetBasePath(const std::string& path); |
|
Wladimir Palant
2014/08/29 18:42:27
This method needs documenting, it isn't part of th
Felix Dahlke
2014/09/01 17:00:15
Done.
| |
| 54 | |
| 47 protected: | 55 protected: |
| 48 std::string basePath; | 56 std::string basePath; |
| 49 }; | 57 }; |
| 50 } | 58 } |
| 51 | 59 |
| 52 #endif | 60 #endif |
| LEFT | RIGHT |