Get rid of get_user_file_path and do the path handling in wrappers for open() and...
[kugel-rb.git] / firmware / include / dir_uncached.h
blob3bae07177b14ea306299c96b0bae38dd70daae38
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: dir.h 13741 2007-06-30 02:08:27Z jethead71 $
10 * Copyright (C) 2002 by Björn Stenberg
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef _DIR_UNCACHED_H_
22 #define _DIR_UNCACHED_H_
24 #include "config.h"
26 struct dirinfo {
27 int attribute;
28 long size;
29 unsigned short wrtdate;
30 unsigned short wrttime;
33 #include <stdbool.h>
34 #include "file.h"
36 #if (CONFIG_PLATFORM & PLATFORM_SDL)
37 # define dirent_uncached sim_dirent
38 # define DIR_UNCACHED SIM_DIR
39 # define opendir_uncached sim_opendir
40 # define readdir_uncached sim_readdir
41 # define closedir_uncached sim_closedir
42 # define mkdir_uncached sim_mkdir
43 # define rmdir_uncached sim_rmdir
44 #endif
46 #ifndef DIRENT_DEFINED
48 struct dirent_uncached {
49 unsigned char d_name[MAX_PATH];
50 struct dirinfo info;
51 long startcluster;
53 #endif
55 #include "fat.h"
57 #ifndef DIR_DEFINED
58 typedef struct {
59 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
60 bool busy;
61 long startcluster;
62 struct fat_dir fatdir;
63 struct dirent_uncached theent;
64 #ifdef HAVE_MULTIVOLUME
65 int volumecounter; /* running counter for faked volume entries */
66 #endif
67 #else
68 /* simulator/application: */
69 void *dir; /* actually a DIR* dir */
70 char *name;
71 #endif
72 } DIR_UNCACHED;
73 #endif
76 #if defined(APPLICATION)
77 #if (CONFIG_PLATFORM & PLATFORM_ANDROID)
78 #include "dir-target.h"
79 #endif
80 # undef opendir_uncached
81 # define opendir_uncached app_opendir
82 # undef mkdir_uncached
83 # define mkdir_uncached app_mkdir
84 # undef rmdir_uncached
85 # define rmdir_uncached app_rmdir
86 /* defined in rbpaths.c */
87 extern DIR_UNCACHED* app_opendir(const char* name);
88 extern int app_rmdir(const char* name);
89 extern int app_mkdir(const char* name);
90 #endif
92 #ifdef HAVE_HOTSWAP
93 char *get_volume_name(int volume);
94 #endif
96 #ifdef HAVE_MULTIVOLUME
97 int strip_volume(const char*, char*);
98 #endif
100 #ifndef DIRFUNCTIONS_DEFINED
102 extern DIR_UNCACHED* opendir_uncached(const char* name);
103 extern int closedir_uncached(DIR_UNCACHED* dir);
104 extern int mkdir_uncached(const char* name);
105 extern int rmdir_uncached(const char* name);
107 extern struct dirent_uncached* readdir_uncached(DIR_UNCACHED* dir);
109 extern int release_dirs(int volume);
111 #endif /* DIRFUNCTIONS_DEFINED */
113 #endif