blob: b282603e4e9d16bbc00bd248a5117485fede3f62 [file] [log] [blame]
Shinichiro Hamaji1d545aa2015-06-23 15:29:13 +09001// Copyright 2015 Google Inc. All rights reserved
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090015#ifndef FILEUTIL_H_
16#define FILEUTIL_H_
17
Shinichiro Hamaji0e3873a2015-07-05 15:48:28 +090018#include <memory>
Shinichiro Hamaji94d6f2a2015-07-05 05:32:25 +090019#include <string>
Shinichiro Hamajia09ed282015-07-31 12:21:54 +090020#include <unordered_map>
Shinichiro Hamaji0e3873a2015-07-05 15:48:28 +090021#include <vector>
Shinichiro Hamaji94d6f2a2015-07-05 05:32:25 +090022
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090023#include "string_piece.h"
24
Shinichiro Hamaji94d6f2a2015-07-05 05:32:25 +090025using namespace std;
26
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090027bool Exists(StringPiece f);
Shinichiro Hamajifda79432015-07-05 03:17:34 +090028double GetTimestamp(StringPiece f);
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090029
Shinichiro Hamaji94d6f2a2015-07-05 05:32:25 +090030int RunCommand(const string& shell, const string& cmd, bool redirect_stderr,
31 string* out);
32
Shinichiro Hamajib58bb4b2015-07-30 18:02:51 +090033void GetExecutablePath(string* path);
34
Shinichiro Hamaji0e3873a2015-07-05 15:48:28 +090035void Glob(const char* pat, vector<string>** files);
36
Shinichiro Hamajia09ed282015-07-31 12:21:54 +090037const unordered_map<string, vector<string>*>& GetAllGlobCache();
38
39void ClearGlobCache();
40
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090041#endif // FILEUTIL_H_