|
@@ -7,6 +7,7 @@
|
|
|
#include "core/filesystem/file.h"
|
|
#include "core/filesystem/file.h"
|
|
|
#include "core/filesystem/filesystem_disk.h"
|
|
#include "core/filesystem/filesystem_disk.h"
|
|
|
#include "core/filesystem/path.h"
|
|
#include "core/filesystem/path.h"
|
|
|
|
|
+#include "core/guid.h"
|
|
|
#include "core/memory/temp_allocator.inl"
|
|
#include "core/memory/temp_allocator.inl"
|
|
|
#include "core/os.h"
|
|
#include "core/os.h"
|
|
|
#include "core/strings/dynamic_string.inl"
|
|
#include "core/strings/dynamic_string.inl"
|
|
@@ -251,6 +252,19 @@ File *FilesystemDisk::open(const char *path, FileOpenMode::Enum mode)
|
|
|
return file;
|
|
return file;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+File *FilesystemDisk::open_temporary(DynamicString &absolute_path)
|
|
|
|
|
+{
|
|
|
|
|
+ TempAllocator256 ta;
|
|
|
|
|
+ DynamicString tmp_basename(ta);
|
|
|
|
|
+ tmp_basename.from_guid(guid::new_guid());
|
|
|
|
|
+ tmp_basename += ".tmp";
|
|
|
|
|
+ this->absolute_path(absolute_path, tmp_basename.c_str());
|
|
|
|
|
+
|
|
|
|
|
+ FileDisk *file = CE_NEW(*_allocator, FileDisk)();
|
|
|
|
|
+ file->open(absolute_path.c_str(), FileOpenMode::WRITE);
|
|
|
|
|
+ return file;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void FilesystemDisk::close(File &file)
|
|
void FilesystemDisk::close(File &file)
|
|
|
{
|
|
{
|
|
|
CE_DELETE(*_allocator, &file);
|
|
CE_DELETE(*_allocator, &file);
|