Skip to content

Commit e2fc031

Browse files
Remove unused type temp_working_dirt
This type has been added in 2012 and is presently unused. In its present state it is difficult to use as it doesn't permit any way to recover from potential errors (it is instead asserted that no errors can happen, which is not true). Should functionality like this be needed in the future, I'd recommend a wrapper function like ``` template<typename Closure> void run_with_different_working_dir( const std::string& working_dir, Closure closure); ``` Which would change the working directory, execute the closure and change the working directory back afterwards, throwing a system_exceptiont on failure.
1 parent 3705a60 commit e2fc031

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed

src/util/tempdir.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,3 @@ temp_dirt::~temp_dirt()
101101
{
102102
clear();
103103
}
104-
105-
temp_working_dirt::temp_working_dirt(const std::string &name_template):
106-
temp_dirt(name_template)
107-
{
108-
old_working_directory=get_current_working_directory();
109-
if(chdir(path.c_str())!=0)
110-
CHECK_RETURN(false);
111-
}
112-
113-
temp_working_dirt::~temp_working_dirt()
114-
{
115-
if(chdir(old_working_directory.c_str())!=0)
116-
CHECK_RETURN(false);
117-
}

src/util/tempdir.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,4 @@ class temp_dirt
2929
~temp_dirt();
3030
};
3131

32-
// Produces a temporary directory,
33-
// chdir()s there,
34-
// and deletes it upon destruction,
35-
// and goes back to the old working directory.
36-
class temp_working_dirt:public temp_dirt
37-
{
38-
public:
39-
std::string old_working_directory;
40-
41-
explicit temp_working_dirt(const std::string &name_template);
42-
~temp_working_dirt();
43-
};
44-
4532
#endif // CPROVER_UTIL_TEMPDIR_H

0 commit comments

Comments
 (0)