Add love.filesystem.openFile. Deprecate love.filesystem.newFile.

This commit is contained in:
Alex Szpakowski
2022-04-22 21:05:20 -03:00
parent e167a77994
commit b8ff64e9e3
6 changed files with 69 additions and 44 deletions
+10 -8
View File
@@ -46,13 +46,8 @@ NativeFile::NativeFile(const std::string &filename, Mode mode)
, bufferMode(BUFFER_NONE)
, bufferSize(0)
{
open(mode);
}
NativeFile::~NativeFile()
{
if (mode != MODE_CLOSED)
close();
if (!open(mode))
throw love::Exception("Could not open file at path %s", filename.c_str());
}
NativeFile::NativeFile(const NativeFile &other)
@@ -62,7 +57,14 @@ NativeFile::NativeFile(const NativeFile &other)
, bufferMode(other.bufferMode)
, bufferSize(other.bufferSize)
{
open(other.mode);
if (!open(other.mode))
throw love::Exception("Could not open file at path %s", filename.c_str());
}
NativeFile::~NativeFile()
{
if (mode != MODE_CLOSED)
close();
}
NativeFile *NativeFile::clone()