summaryrefslogtreecommitdiff
path: root/utils/filelib.cc
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2011-07-12 22:34:34 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2011-07-12 22:34:34 -0400
commitc87835f5f94b3aa954682133c40117b3f8e26585 (patch)
treedfe5e8cffbdbf3b911d7ef6fc9d7eb8508a28d89 /utils/filelib.cc
parent9ab32f74dd821f08cb5863faf88d40ca60301688 (diff)
debugged pro trainer
Diffstat (limited to 'utils/filelib.cc')
-rw-r--r--utils/filelib.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/filelib.cc b/utils/filelib.cc
index 79ad2847..a0969b1a 100644
--- a/utils/filelib.cc
+++ b/utils/filelib.cc
@@ -20,3 +20,15 @@ bool DirectoryExists(const string& dir) {
return false;
}
+void MkDirP(const string& dir) {
+ if (DirectoryExists(dir)) return;
+ if (mkdir(dir.c_str(), 0777)) {
+ perror(dir.c_str());
+ abort();
+ }
+ if (chmod(dir.c_str(), 07777)) {
+ perror(dir.c_str());
+ abort();
+ }
+}
+