|
3 | 3 | #include "../src/parser/parser_state.h"
|
4 | 4 |
|
5 | 5 | #include <fstream>
|
| 6 | +#include <filesystem> |
6 | 7 |
|
7 | 8 | #include "daScript/ast/ast.h"
|
8 | 9 |
|
@@ -169,12 +170,12 @@ Result transform_syntax(const string &filename, const string content, format::Fo
|
169 | 170 |
|
170 | 171 | int iter = 0;
|
171 | 172 | policies.version_2_syntax = false;
|
172 |
| - const auto tmp_name1 = "/tmp/tmp1.das"; |
| 173 | + const auto tmp_name1 = std::filesystem::temp_directory_path() / "tmp1.das"; |
173 | 174 | {
|
174 | 175 | std::ofstream ostream(tmp_name1);
|
175 | 176 | ostream << src.c_str();
|
176 | 177 | }
|
177 |
| - auto src_program = parseDaScript(tmp_name1, "", access, tout, libGroup, true, true, policies); |
| 178 | + auto src_program = parseDaScript(tmp_name1.string(), "", access, tout, libGroup, true, true, policies); |
178 | 179 | while (prev != src) {
|
179 | 180 | prev = src;
|
180 | 181 |
|
@@ -236,14 +237,14 @@ Result transform_syntax(const string &filename, const string content, format::Fo
|
236 | 237 | if (!options.contains(FormatOpt::SemicolonEOL)) {
|
237 | 238 | src = remove_semicolons(src, options.contains(FormatOpt::V2Syntax));
|
238 | 239 | }
|
239 |
| - const auto tmp_name = "/tmp/tmp.das"; |
| 240 | + const auto tmp_name = std::filesystem::temp_directory_path() / "tmp.das"; |
240 | 241 | {
|
241 | 242 | std::ofstream ostream(tmp_name);
|
242 | 243 | ostream << src.c_str();
|
243 | 244 | ostream.flush();
|
244 | 245 | }
|
245 | 246 | policies.version_2_syntax = options.contains(format::FormatOpt::V2Syntax);
|
246 |
| - auto program = parseDaScript(tmp_name, "", access, tout, libGroup, true, true, policies); |
| 247 | + auto program = parseDaScript(tmp_name.string(), "", access, tout, libGroup, true, true, policies); |
247 | 248 | Result res;
|
248 | 249 | if (!program->failed()) {
|
249 | 250 | res.ok = src; // designated initializers not supported in CI
|
|
0 commit comments