diff --git a/.monadid b/.monadid index 132b5f4d3c0bee801ccd1b0a9420ad5f99650546..98219dad83eaa130cf74f0b2c230752f3fd85206 100644 --- a/.monadid +++ b/.monadid @@ -1,4 +1,4 @@ monad identification file This file is used for monad directory identification Built by toole1 on linux3.ews.illinois.edu -Build Date: Sat Sep 3 17:00:04 CDT 2011 +Build Date: Sun Sep 4 14:15:12 CDT 2011 diff --git a/monad b/monad index c3e79d9d7ad9fff624a9e4e58b3294a7a7e6a694..4a0d80eca949033fb91e8d357db2884255ae6cd0 100755 Binary files a/monad and b/monad differ diff --git a/util.cpp b/util.cpp index b11a669dd3fb840079533a813867bd8048f4b76d..68ba96a0ad7a721245444af1a856449f33bea1a4 100644 --- a/util.cpp +++ b/util.cpp @@ -171,6 +171,11 @@ int8_t exec(int redirect_fd, const char * command, } +int chdir(const string & dir) +{ + return ::chdir(dir.c_str()); +} + void assertExists(const string & path, int exit_code /* = -1 */) { if (!exists(path)) diff --git a/util.h b/util.h index 6cc422f4f6e4de5304e72808f7722ae394d7bd77..718b241c79df3f095d02b044836e86a1e9c087fc 100644 --- a/util.h +++ b/util.h @@ -78,6 +78,20 @@ int8_t exec(const char * command, const char * arg6 = NULL) { return exec(STDOUT_FILENO, command, arg1, arg2, arg3, arg4, arg5, arg6); } +inline int8_t exec(const string & command) { return exec(command.c_str()); } +inline int8_t exec(const string & command, const string & arg1) { return exec(command.c_str(), arg1.c_str()); } +inline int8_t exec(const string & command, const string & arg1, const string & arg2) { return exec(command.c_str(), arg1.c_str(), arg2.c_str()); } +inline int8_t exec(const string & command, const string & arg1, const string & arg2, const string & arg3) { return exec(command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str()); } +inline int8_t exec(const string & command, const string & arg1, const string & arg2, const string & arg3, const string & arg4) { return exec(command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str(), arg4.c_str()); } +inline int8_t exec(const string & command, const string & arg1, const string & arg2, const string & arg3, const string & arg4, const string & arg5) { return exec(command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str(), arg4.c_str(), arg5.c_str()); } +inline int8_t exec(const string & command, const string & arg1, const string & arg2, const string & arg3, const string & arg4, const string & arg5, const string & arg6) { return exec(command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str(), arg4.c_str(), arg5.c_str(), arg6.c_str()); } +inline int8_t exec(int redirect_fd, const string & command) { return exec(redirect_fd, command.c_str()); } +inline int8_t exec(int redirect_fd, const string & command, const string & arg1) { return exec(redirect_fd, command.c_str(), arg1.c_str()); } +inline int8_t exec(int redirect_fd, const string & command, const string & arg1, const string & arg2) { return exec(redirect_fd, command.c_str(), arg1.c_str(), arg2.c_str()); } +inline int8_t exec(int redirect_fd, const string & command, const string & arg1, const string & arg2, const string & arg3) { return exec(redirect_fd, command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str()); } +inline int8_t exec(int redirect_fd, const string & command, const string & arg1, const string & arg2, const string & arg3, const string & arg4) { return exec(redirect_fd, command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str(), arg4.c_str()); } +inline int8_t exec(int redirect_fd, const string & command, const string & arg1, const string & arg2, const string & arg3, const string & arg4, const string & arg5) { return exec(redirect_fd, command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str(), arg4.c_str(), arg5.c_str()); } +inline int8_t exec(int redirect_fd, const string & command, const string & arg1, const string & arg2, const string & arg3, const string & arg4, const string & arg5, const string & arg6) { return exec(redirect_fd, command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str(), arg4.c_str(), arg5.c_str(), arg6.c_str()); } // FILESYSTEM FUNCTIONS void assertExists(const string & path, int exit_code = -1); @@ -86,6 +100,7 @@ mode_t permissions(const string & path); void forceRemoveDir(string dir); string getcwdstr(); +int chdir(const string & dir); void copyFile(const string & source, const string & dest); void copyFiles(const string & sourceFolder, const string & destFolder, const vector<string> & files); void protectFiles(const string & folder, const vector<string> & files);