patch compilation android
This commit is contained in:
1 parent
876e686535
commit
b09951b596
1 file changed
+6
-6
@@ -33,22 +33,22 @@
|
|||||||
static void copy_asset(char* src, char* dst) {
|
static void copy_asset(char* src, char* dst) {
|
||||||
SDL_RWops* file = SDL_RWFromFile(src, "r");
|
SDL_RWops* file = SDL_RWFromFile(src, "r");
|
||||||
if (!file)
|
if (!file)
|
||||||
ERROR("%s", "[ERROR] SDL_RWFromFile: %s\n", src);
|
ERROR("[ERROR] SDL_RWFromFile: %s\n", src);
|
||||||
int size = SDL_RWsize(file);
|
int size = SDL_RWsize(file);
|
||||||
PRINT("%s", "copy file %s (%d bytes) into %s\n", src, size, dst);
|
PRINT("copy file %s (%d bytes) into %s\n", src, size, dst);
|
||||||
char* buf = (char*)malloc(size + 1);
|
char* buf = (char*)malloc(size + 1);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
ERROR("%s", "[ERROR] malloc\n");
|
ERROR("%s", "[ERROR] malloc\n");
|
||||||
int r = SDL_RWread(file, buf, 1, size);
|
int r = SDL_RWread(file, buf, 1, size);
|
||||||
PRINT("%s", "read %d\n", r);
|
PRINT("read %d\n", r);
|
||||||
if (r != size)
|
if (r != size)
|
||||||
ERROR("%s", "[ERROR] fail to read all file (%d bytes)\n", r);
|
ERROR("[ERROR] fail to read all file (%d bytes)\n", r);
|
||||||
FILE* out = fopen(dst, "w+");
|
FILE* out = fopen(dst, "w+");
|
||||||
if (!out)
|
if (!out)
|
||||||
ERROR("%s", "[ERROR] fail to create file %s\n", dst);
|
ERROR("[ERROR] fail to create file %s\n", dst);
|
||||||
int w = fwrite(buf, 1, r, out);
|
int w = fwrite(buf, 1, r, out);
|
||||||
if (r != w)
|
if (r != w)
|
||||||
ERROR("%s", "[ERROR] fail to write all file (%d bytes)\n", w);
|
ERROR("[ERROR] fail to write all file (%d bytes)\n", w);
|
||||||
fclose(out);
|
fclose(out);
|
||||||
SDL_RWclose(file);
|
SDL_RWclose(file);
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|||||||
Reference in new issue
Block a user