[llvm-commits] [llvm] r140433 - in /llvm/trunk: include/llvm/Support/Process.h lib/Support/Unix/Process.inc lib/Support/Windows/Process.inc
Daniel Dunbar
daniel at zuster.org
Fri Sep 23 16:23:36 PDT 2011
Author: ddunbar
Date: Fri Sep 23 18:23:36 2011
New Revision: 140433
URL: http://llvm.org/viewvc/llvm-project?rev=140433&view=rev
Log:
sys::Process: Add a SetWorkingDirectory method.
Modified:
llvm/trunk/include/llvm/Support/Process.h
llvm/trunk/lib/Support/Unix/Process.inc
llvm/trunk/lib/Support/Windows/Process.inc
Modified: llvm/trunk/include/llvm/Support/Process.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Process.h?rev=140433&r1=140432&r2=140433&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Process.h (original)
+++ llvm/trunk/include/llvm/Support/Process.h Fri Sep 23 18:23:36 2011
@@ -138,6 +138,9 @@
/// Resets the terminals colors, or returns an escape sequence to do so.
static const char *ResetColor();
+
+ /// Change the program working directory to that given by \arg Path.
+ static void SetWorkingDirectory(std::string Path);
/// @}
};
}
Modified: llvm/trunk/lib/Support/Unix/Process.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Process.inc?rev=140433&r1=140432&r2=140433&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Process.inc (original)
+++ llvm/trunk/lib/Support/Unix/Process.inc Fri Sep 23 18:23:36 2011
@@ -293,3 +293,7 @@
const char *Process::ResetColor() {
return "\033[0m";
}
+
+void Process::SetWorkingDirectory(std::string Path) {
+ ::chdir(Path.c_str());
+}
Modified: llvm/trunk/lib/Support/Windows/Process.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Process.inc?rev=140433&r1=140432&r2=140433&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Process.inc (original)
+++ llvm/trunk/lib/Support/Windows/Process.inc Fri Sep 23 18:23:36 2011
@@ -15,6 +15,7 @@
#include <psapi.h>
#include <malloc.h>
#include <io.h>
+#include <direct.h>
#ifdef __MINGW32__
#if (HAVE_LIBPSAPI != 1)
@@ -219,4 +220,8 @@
return 0;
}
+void Process::SetWorkingDirectory(std::string Path) {
+ ::_chdir(Path.c_str());
+}
+
}
More information about the llvm-commits
mailing list