implement MakeSureDirectoryPathExists()

This commit is contained in:
Sébastien Noel 2025-02-17 08:58:48 +01:00
parent 698af6d1f8
commit 36778432b8

View File

@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <filesystem>
// !!! FIXME : rcg10162001 Need this anymore, since _findfirst() is abstracted?
#ifdef PLATFORM_WIN32
@ -918,7 +919,13 @@ void CTFileStream::Open_t(const CTFileName &fnFileName, CTStream::OpenMode om/*=
static void MakeSureDirectoryPathExists(const CTFileName &fnmFullFileName)
{
STUBBED("!!! FIXME: get the code back in from Ryan's original port.");
CTFileName fnDirectory = fnmFullFileName.FileDir();
const char *path = (const char *) (CTString&)fnDirectory;
std::error_code ec;
std::filesystem::create_directories(path, ec);
if (ec) {
FatalError("Cannot create directory path:\n%s", path);
}
}
/*