Commit 3f5afb3 1 parent 151356c commit 3f5afb3 Copy full SHA for 3f5afb3
File tree 3 files changed +7
-4
lines changed
3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 18
18
19
19
// System include(s).
20
20
#include < cstdint>
21
+ #include < filesystem>
21
22
22
23
namespace detray ::io::csv {
23
24
@@ -120,7 +121,7 @@ inline void write_intersection2D(
120
121
inters_file_name = io::alt_file_name (file_name);
121
122
} else {
122
123
// Make sure the output directories exit
123
- io::create_path (inters_file_name);
124
+ io::create_path (std::filesystem::path{ inters_file_name}. parent_path () );
124
125
}
125
126
126
127
dfe::NamedTupleCsvWriter<io::csv::intersection2D> inters_writer (
Original file line number Diff line number Diff line change 16
16
#include < dfe/dfe_io_dsv.hpp>
17
17
#include < dfe/dfe_namedtuple.hpp>
18
18
19
+ // System include(s)
20
+ #include < filesystem>
21
+
19
22
namespace detray ::io::csv {
20
23
21
24
// / Type to read the data of free track parameters
@@ -110,7 +113,7 @@ inline void write_free_track_params(
110
113
trk_file_name = io::alt_file_name (file_name);
111
114
} else {
112
115
// Make sure the output directories exit
113
- io::create_path (trk_file_name);
116
+ io::create_path (std::filesystem::path{ trk_file_name}. parent_path () );
114
117
}
115
118
116
119
dfe::NamedTupleCsvWriter<io::csv::free_track_parameters> track_param_writer (
Original file line number Diff line number Diff line change @@ -71,9 +71,8 @@ inline std::string alt_file_name(const std::string& name) {
71
71
inline auto create_path (const std::string& outdir) {
72
72
73
73
auto path = std::filesystem::path (outdir);
74
- path = std::filesystem::is_directory (path) ? path : path.parent_path ();
75
74
76
- if (!std::filesystem::exists (path)) {
75
+ if (!path. empty () && ! std::filesystem::exists (path)) {
77
76
if (std::error_code err;
78
77
!std::filesystem::create_directories (path, err)) {
79
78
throw std::runtime_error (err.message ());
You can’t perform that action at this time.
0 commit comments