aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/util/file.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/cpp/util/file.cc')
-rw-r--r--src/main/cpp/util/file.cc38
1 files changed, 4 insertions, 34 deletions
diff --git a/src/main/cpp/util/file.cc b/src/main/cpp/util/file.cc
index 3eb614c0dc..041d7798dc 100644
--- a/src/main/cpp/util/file.cc
+++ b/src/main/cpp/util/file.cc
@@ -11,6 +11,9 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
+
+#include "src/main/cpp/util/file.h"
+
#include <limits.h> // PATH_MAX
#include <algorithm>
@@ -19,7 +22,7 @@
#include "src/main/cpp/util/errors.h"
#include "src/main/cpp/util/exit_code.h"
-#include "src/main/cpp/util/file.h"
+#include "src/main/cpp/util/path.h"
#include "src/main/cpp/util/strings.h"
namespace blaze_util {
@@ -85,39 +88,6 @@ bool WriteFile(const std::string &content, const std::string &filename,
return WriteFile(content.c_str(), content.size(), filename, perm);
}
-string Dirname(const string &path) {
- return SplitPath(path).first;
-}
-
-string Basename(const string &path) {
- return SplitPath(path).second;
-}
-
-string JoinPath(const string &path1, const string &path2) {
- if (path1.empty()) {
- // "" + "/bar"
- return path2;
- }
-
- if (path1[path1.size() - 1] == '/') {
- if (path2.find('/') == 0) {
- // foo/ + /bar
- return path1 + path2.substr(1);
- } else {
- // foo/ + bar
- return path1 + path2;
- }
- } else {
- if (path2.find('/') == 0) {
- // foo + /bar
- return path1 + path2;
- } else {
- // foo + bar
- return path1 + "/" + path2;
- }
- }
-}
-
class DirectoryTreeWalker : public DirectoryEntryConsumer {
public:
DirectoryTreeWalker(vector<string> *files,