finish up plugin architecture
[csRadar.git] / csrIO.h
diff --git a/csrIO.h b/csrIO.h
index 898b41a3d11977ea2e8b0062b8137b8edc06724b..76bed7e228fd138f0cc5652fad8ff3f4a30042c9 100644 (file)
--- a/csrIO.h
+++ b/csrIO.h
@@ -1,6 +1,36 @@
+// Copyright (C) 2021 Harry Godden (hgn)
+
 // Low level disk reading
 //=======================================================================================================================
 
+// Read binary, or text assets. _s variants also give size in bytes
+void *csr_asset_read_s( const char *path, i64 *size );
+void *csr_asset_read( const char *path );
+char *csr_textasset_read_s( const char *path, i64 *size );
+char *csr_textasset_read( const char *name );
+
+i64 fs_file_size( FILE *fileptr );
+
+// Path handling
+// -------------
+
+// Find file path extension, returns NULL if no ext (0x00)
+char *csr_findext( char *path, char const delim );
+
+// gets rid of extension on string only left with (folder)+filename
+void csr_stripext( char *path );
+
+int csr_path_is_abs( char const *path );
+
+// Convert windows paths to unix.. sortof ( \something\\blahblah .. ) -> /something/blahblah/
+// Does not handle drive letters, idea is to increase windows compatibility will the other functions above
+void csr_path_winunix( char *path );
+
+// Implementation
+//=======================================================================================================================
+
+#ifdef CSR_EXECUTABLE
+
 i64 fs_file_size( FILE *fileptr )
 {
        fseek( fileptr, 0, SEEK_END );
@@ -77,7 +107,6 @@ char *csr_textasset_read( const char *name )
        return fs_disk_load_text( name, &size );
 }
 
-// Find file path extension, returns NULL if no ext (0x00)
 char *csr_findext( char *path, char const delim )
 {
        char *c, *ptr;
@@ -98,7 +127,6 @@ char *csr_findext( char *path, char const delim )
        return ptr;
 }
 
-// gets rid of extension on string only left with folder/filename
 void csr_stripext( char *path )
 {
        char *point, *start;
@@ -118,7 +146,6 @@ void csr_stripext( char *path )
        }
 }
 
-// Convert windows paths to unix-ish ( \something\\blahblah .. ) -> /something/blahblah/
 void csr_path_winunix( char *path )
 {
        char *idx, *wr;
@@ -155,8 +182,4 @@ int csr_path_is_abs( char const *path )
 #endif
 }
 
-#ifdef _WIN32
- #define GetWorkingDir _getcwd
-#else
- #define GetWorkingDir getcwd
 #endif