File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change 1
1
// SPDX-License-Identifier: LGPL-3.0-only
2
2
#include < cstring>
3
3
#include < climits>
4
+ #include < filesystem>
4
5
#include < unistd.h>
5
6
6
7
#include < sys/stat.h>
@@ -60,15 +61,10 @@ static std::string get_tmpdir(void)
60
61
if (is_writable_dir (" /var/tmp" ))
61
62
return " /var/tmp" ;
62
63
63
- int old_errno = errno;
64
- char *workdir = get_current_dir_name ();
65
- errno = old_errno;
66
- if (workdir != nullptr ) {
67
- std::string wdir_str (workdir);
68
- free (workdir);
69
- if (is_writable_dir (workdir))
70
- return workdir;
71
- }
64
+ std::string workdir = std::filesystem::current_path ();
65
+
66
+ if (is_writable_dir (workdir))
67
+ return workdir;
72
68
73
69
LOG (FATAL) << " Unable to get temporary directory." ;
74
70
std::abort ();
Original file line number Diff line number Diff line change 1
1
// SPDX-License-Identifier: LGPL-3.0-only
2
2
#include < algorithm>
3
3
#include < iostream>
4
+ #include < filesystem>
4
5
#include < fstream>
5
6
#include < memory>
6
7
#include < sstream>
@@ -322,7 +323,7 @@ std::string make_absolute(const std::string &path)
322
323
if (path.empty () || path[0 ] == ' /' )
323
324
return path;
324
325
325
- return std::string ( get_current_dir_name ()) + ' / ' + path;
326
+ return std::filesystem::current_path () / path;
326
327
}
327
328
328
329
std::optional<Rule> parse_rule_arg (size_t rulepos, const std::string &arg)
You can’t perform that action at this time.
0 commit comments