mirror of https://github.com/bjornbytes/lovr.git
rm lovr.filesystem.write;
This commit is contained in:
parent
09359c6793
commit
7362fafd8c
|
@ -1,7 +1,7 @@
|
|||
#include "filesystem.h"
|
||||
#include "../util.h"
|
||||
#include <physfs.h>
|
||||
#ifdef APPLE
|
||||
#ifdef __APPLE__
|
||||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
|
||||
|
@ -20,8 +20,8 @@ int lovrFilesystemExists(const char* path) {
|
|||
}
|
||||
|
||||
const char* lovrFilesystemGetExecutablePath() {
|
||||
#ifdef APPLE
|
||||
char path[1024];
|
||||
#ifdef __APPLE__
|
||||
char* path = malloc(1024);
|
||||
uint32_t size = sizeof(path);
|
||||
if (_NSGetExecutablePath(path, &size) == 0) {
|
||||
return path;
|
||||
|
@ -75,17 +75,3 @@ void* lovrFilesystemRead(const char* path, int* bytesRead) {
|
|||
int lovrFilesystemSetSource(const char* source) {
|
||||
return PHYSFS_mount(source, NULL, 0);
|
||||
}
|
||||
|
||||
int lovrFilesystemWrite(const char* path, const char* contents, int size) {
|
||||
|
||||
// Open file
|
||||
PHYSFS_file* handle = PHYSFS_openWrite(path);
|
||||
if (!handle) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Perform write
|
||||
int bytesWritten = PHYSFS_write(handle, contents, 1, size);
|
||||
PHYSFS_close(handle);
|
||||
return bytesWritten;
|
||||
}
|
||||
|
|
|
@ -6,4 +6,3 @@ int lovrFilesystemIsDirectory(const char* path);
|
|||
int lovrFilesystemIsFile(const char* path);
|
||||
void* lovrFilesystemRead(const char* path, int* bytesRead);
|
||||
int lovrFilesystemSetSource(const char* source);
|
||||
int lovrFilesystemWrite(const char* path, const char* contents, int size);
|
||||
|
|
|
@ -55,7 +55,6 @@ const luaL_Reg lovrFilesystem[] = {
|
|||
{ "isFile", l_lovrFilesystemIsFile },
|
||||
{ "read", l_lovrFilesystemRead },
|
||||
{ "setSource", l_lovrFilesystemSetSource },
|
||||
{ "write", l_lovrFilesystemWrite },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
@ -135,11 +134,3 @@ int l_lovrFilesystemSetSource(lua_State* L) {
|
|||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int l_lovrFilesystemWrite(lua_State* L) {
|
||||
int size;
|
||||
const char* path = luaL_checkstring(L, 1);
|
||||
const char* contents = luaL_checklstring(L, 2, &size);
|
||||
lua_pushnumber(L, lovrFilesystemWrite(path, contents, size));
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -10,5 +10,4 @@ int l_lovrFilesystemGetExecutablePath(lua_State* L);
|
|||
int l_lovrFilesystemIsDirectory(lua_State* L);
|
||||
int l_lovrFilesystemIsFile(lua_State* L);
|
||||
int l_lovrFilesystemRead(lua_State* L);
|
||||
int l_lovrFilesystemWrite(lua_State* L);
|
||||
int l_lovrFilesystemSetSource(lua_State* L);
|
||||
|
|
Loading…
Reference in New Issue