way better controller handling
[vg.git] / vg_io.h
diff --git a/vg_io.h b/vg_io.h
index 779b8726c09db9e81d45063422518bde1f3bbe92..93525446094aa6a9ee3dac9ff9e0fad914b4673f 100644 (file)
--- a/vg_io.h
+++ b/vg_io.h
 #include <stdio.h>
 #include <errno.h>
 
+#define _TINYDIR_MALLOC(_size) vg_linear_alloc( vg_mem.scratch, _size )
+#define _TINYDIR_FREE(_size) 
+
+#include "submodules/tinydir/tinydir.h"
+
 /*
  * File I/O
  */
 
 VG_STATIC void vg_file_print_invalid( FILE *fp )
 {
-   if( feof( fp )) 
-   {
+   if( feof( fp )) {
       vg_error( "mdl_open: header too short\n" );
    }
-   else
-   {
+   else{
       if( ferror( fp ))
          vg_error( "mdl_open: %s\n", strerror(errno) );
       else
@@ -71,8 +74,7 @@ VG_STATIC void *vg_file_read( void *lin_alloc, const char *path, u32 *size )
       
       return buffer;
        }
-       else
-       {
+       else{
       vg_error( "vg_disk_open_read: %s\n", strerror(errno) );
                return NULL;
        }
@@ -96,17 +98,14 @@ VG_STATIC char *vg_file_read_text( void *lin_alloc, const char *path, u32 *sz )
 }
 
 
-VG_STATIC int vg_asset_write( const char *path, void *data, i64 size )
-{
+VG_STATIC int vg_asset_write( const char *path, void *data, i64 size ){
        FILE *f = fopen( path, "wb" );
-       if( f )
-       {
+       if( f ){
                fwrite( data, size, 1, f );
                fclose( f );
                return 1;
        }
-       else
-       {
+       else{
                return 0;
        }
 }