Mercurial > love-experiments
diff src/modules/filesystem/physfs/Filesystem.cpp @ 1382:07f9f786e56b
Added love.filesystem.append (issue #541)
| author | Alex Szpakowski <slime73@gmail.com> |
|---|---|
| date | Sun, 17 Mar 2013 03:40:13 -0300 |
| parents | 4031a4e6cf25 |
| children | d8a56ce3b488 |
line wrap: on
line diff
--- a/src/modules/filesystem/physfs/Filesystem.cpp Sun Mar 17 03:30:36 2013 -0300 +++ b/src/modules/filesystem/physfs/Filesystem.cpp Sun Mar 17 03:40:13 2013 -0300 @@ -319,7 +319,7 @@ return file.read(size); } -void Filesystem::write(const char *filename, const void *data, int64 size) +void Filesystem::write(const char *filename, const void *data, int64 size) const { File file(filename); @@ -330,6 +330,17 @@ throw love::Exception("Data could not be written."); } +void Filesystem::append(const char *filename, const void *data, int64 size) const +{ + File file(filename); + + file.open(File::APPEND); + + // close() is called in the File destructor. + if (!file.write(data, size)) + throw love::Exception("Data could not be written."); +} + int Filesystem::enumerate(lua_State *L) { int n = lua_gettop(L);
