Make the sys::Path::GetTemporaryDirectory method not throw exceptions and

adjust users of it to compensate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29831 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer
2006-08-22 19:01:30 +00:00
parent be4f88a8b8
commit 487447626c
4 changed files with 70 additions and 37 deletions

View File

@@ -244,7 +244,12 @@ template<typename GraphType>
sys::Path WriteGraph(const GraphType &G,
const std::string& Name,
const std::string& Title = "") {
sys::Path Filename = sys::Path::GetTemporaryDirectory();;
std::string ErrMsg;
sys::Path Filename = sys::Path::GetTemporaryDirectory(&ErrMsg);
if (Filename.isEmpty()) {
std::cerr << "Error: " << ErrMsg << "\n";
return Filename;
}
Filename.appendComponent(Name + ".dot");
Filename.makeUnique();
std::cerr << "Writing '" << Filename << "'... ";

View File

@@ -97,10 +97,11 @@ namespace sys {
/// a "standard" place for the operating system. The directory is
/// guaranteed to be created on exit from this function. If the directory
/// cannot be created, the function will throw an exception.
/// @throws std::string indicating why the directory could not be created.
/// @returns an invalid path (empty) on error
/// @param ErrMsg Optional place for an error message if an error occurs
/// @brief Constrct a path to an new, unique, existing temporary
/// directory.
static Path GetTemporaryDirectory();
static Path GetTemporaryDirectory(std::string* ErrMsg);
/// Construct a vector of sys::Path that contains the "standard" system
/// library paths suitable for linking into programs. This function *must*
@@ -171,7 +172,7 @@ namespace sys {
/// @throws std::string if \p unverified_path is not legal.
/// @param unverified_path The path to verify and assign.
/// @brief Construct a Path from a string.
explicit Path(const std::string& unverified_path);
explicit Path(const std::string& p) : path(p) {}
/// @}
/// @name Operators