summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/sdl/sdlos_unix.c
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2010-02-13 17:20:25 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2010-02-13 17:20:25 +0000
commit9758c13b82d6f1041c89b1cfd6b655a3e8e90871 (patch)
tree3f49dc788eb7abf3b91b5aa145492745a80e47d6 /src/osd/sdl/sdlos_unix.c
parent884e1134503a1be7757a3094245753a3366bd977 (diff)
- Removed not used OSD functions
- Placed new functions into sdlos subfiles since they need different implementation (no whatsnew needed)
Diffstat (limited to 'src/osd/sdl/sdlos_unix.c')
-rw-r--r--src/osd/sdl/sdlos_unix.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/osd/sdl/sdlos_unix.c b/src/osd/sdl/sdlos_unix.c
index cb1d619f492..8d78fee7c8b 100644
--- a/src/osd/sdl/sdlos_unix.c
+++ b/src/osd/sdl/sdlos_unix.c
@@ -225,3 +225,89 @@ char *osd_get_clipboard_text(void)
return result;
}
#endif
+
+//============================================================
+// osd_stat
+//============================================================
+
+osd_directory_entry *osd_stat(const char *path)
+{
+ int err;
+ osd_directory_entry *result = NULL;
+ #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD)
+ struct stat st;
+ #else
+ struct stat64 st;
+ #endif
+
+ #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD)
+ err = stat(path, &st);
+ #else
+ err = stat64(path, &st);
+ #endif
+
+ if( err == -1) return NULL;
+
+ // create an osd_directory_entry; be sure to make sure that the caller can
+ // free all resources by just freeing the resulting osd_directory_entry
+ result = (osd_directory_entry *) osd_malloc(sizeof(*result) + strlen(path) + 1);
+ strcpy(((char *) result) + sizeof(*result), path);
+ result->name = ((char *) result) + sizeof(*result);
+ result->type = S_ISDIR(st.st_mode) ? ENTTYPE_DIR : ENTTYPE_FILE;
+ result->size = (UINT64)st.st_size;
+
+ return result;
+}
+
+//============================================================
+// osd_get_volume_name
+//============================================================
+
+const char *osd_get_volume_name(int idx)
+{
+ if (idx!=0) return NULL;
+ return "/";
+}
+
+//============================================================
+// osd_get_full_path
+//============================================================
+
+file_error osd_get_full_path(char **dst, const char *path)
+{
+ file_error err;
+ char path_buffer[512];
+
+ err = FILERR_NONE;
+
+ if (getcwd(path_buffer, 511) == NULL)
+ {
+ printf("osd_get_full_path: failed!\n");
+ err = FILERR_FAILURE;
+ }
+ else
+ {
+ *dst = (char *)malloc(strlen(path_buffer)+strlen(path)+3);
+
+ // if it's already a full path, just pass it through
+ if (path[0] == '/')
+ {
+ strcpy(*dst, path);
+ }
+ else
+ {
+ sprintf(*dst, "%s%s%s", path_buffer, PATH_SEPARATOR, path);
+ }
+ }
+
+ return err;
+}
+
+//============================================================
+// osd_get_emulator_directory
+//============================================================
+
+void osd_get_emulator_directory(char *dir, size_t dir_size)
+{
+ strncpy(dir, sdl_cwd, dir_size);
+}