summaryrefslogtreecommitdiffstats
path: root/src/util.h
diff options
context:
space:
mode:
authorThiago Farina <tfransosi@gmail.com>2011-03-19 21:53:43 (GMT)
committerEvan Martin <martine@danga.com>2011-04-15 19:20:51 (GMT)
commit89a75eff08cd7355f07235938aff4769f97068e5 (patch)
treefff51cd97b561d91ef6a670d21116cd0b03543e9 /src/util.h
parent343c526e6a0c35816c4876bfc923cef15ef7a989 (diff)
downloadNinja-89a75eff08cd7355f07235938aff4769f97068e5.zip
Ninja-89a75eff08cd7355f07235938aff4769f97068e5.tar.gz
Ninja-89a75eff08cd7355f07235938aff4769f97068e5.tar.bz2
Move CanonicalizePath into util.h so it can be shared by the other modules.
Also add util_test.cc and move the CanonicalizePathTest into there. Signed-off-by: Thiago Farina <tfarina@chromium.org>
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 188528c..8c5a6a8 100644
--- a/src/util.h
+++ b/src/util.h
@@ -12,6 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#ifndef NINJA_UTIL_H_
+#define NINJA_UTIL_H_
+#pragma once
+
+#include <string>
+
// Dump a backtrace to stderr.
// |skip_frames| is how many frames to skip;
// DumpBacktrace implicitly skips itself already.
@@ -19,3 +25,8 @@ void DumpBacktrace(int skip_frames);
// Log a fatal message, dump a backtrace, and exit.
void Fatal(const char* msg, ...);
+
+// Canonicalize a path like "foo/../bar.h" into just "bar.h".
+bool CanonicalizePath(std::string* path, std::string* err);
+
+#endif // NINJA_UTIL_H_