summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/os_calls.c21
-rw-r--r--common/os_calls.h2
2 files changed, 23 insertions, 0 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index cb79c7d3..dd73bf45 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -938,6 +938,27 @@ g_file_delete(const char* filename)
}
/*****************************************************************************/
+/* returns file size, -1 on error */
+int APP_CC
+g_file_get_size(const char* filename)
+{
+#if defined(_WIN32)
+ return -1;
+#else
+ struct stat st;
+
+ if (stat(filename, &st) == 0)
+ {
+ return (int)(st.st_size);
+ }
+ else
+ {
+ return -1;
+ }
+#endif
+}
+
+/*****************************************************************************/
/* returns length of text */
int APP_CC
g_strlen(const char* text)
diff --git a/common/os_calls.h b/common/os_calls.h
index 4146c539..f2856288 100644
--- a/common/os_calls.h
+++ b/common/os_calls.h
@@ -132,6 +132,8 @@ g_remove_dir(const char* dirname);
int APP_CC
g_file_delete(const char* filename);
int APP_CC
+g_file_get_size(const char* filename);
+int APP_CC
g_strlen(const char* text);
char* APP_CC
g_strcpy(char* dest, const char* src);