14 #include "file-path.hh"
20 open_file_stream (String filename, std::ios_base::openmode mode)
23 open_file_stream (String filename, int mode)
27 if ((filename == "-"))
31 Path p = split_path (filename);
32 if (!p.dir.empty_b ())
33 if (mkdir (p.dir.to_str0 (), 0777) == -1 && errno != EEXIST)
34 error (_f ("can't create directory: `%s'", p.dir));
35 os = new std::ofstream (filename.to_str0 (), mode);
38 error (_f ("can't open file: `%s'", filename));
43 close_file_stream (std::ostream *os)
48 warning (_ ("Error syncing file (disk full?)"));
49 exit_status_global = 1;