summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/src/s_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/s_file.c')
-rw-r--r--apps/plugins/pdbox/PDa/src/s_file.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/apps/plugins/pdbox/PDa/src/s_file.c b/apps/plugins/pdbox/PDa/src/s_file.c
index 27825d5948..f98741cf2a 100644
--- a/apps/plugins/pdbox/PDa/src/s_file.c
+++ b/apps/plugins/pdbox/PDa/src/s_file.c
@@ -6,14 +6,32 @@
6 * this file contains file-handling routines. 6 * this file contains file-handling routines.
7 */ 7 */
8 8
9#ifdef ROCKBOX
10#include "plugin.h"
11#include "pdbox.h"
12#include "m_pd.h"
13#include "s_stuff.h"
14#else /* ROCKBOX */
9#include "m_pd.h" 15#include "m_pd.h"
10#include "s_stuff.h" 16#include "s_stuff.h"
11#include <sys/types.h> 17#include <sys/types.h>
12#include <sys/stat.h> 18#include <sys/stat.h>
19#endif /* ROCKBOX */
13 20
14 /* LATER delete this? -- replaced by find_via_path() in s_path.c */ 21 /* LATER delete this? -- replaced by find_via_path() in s_path.c */
15int sys_isreadablefile(const char *s) 22int sys_isreadablefile(const char *s)
16{ 23{
24#ifdef ROCKBOX
25 int fd;
26
27 if((fd = open(s, O_RDONLY)))
28 {
29 close(fd);
30 return 1;
31 }
32 else
33 return 0;
34#else /* ROCKBOX */
17 struct stat statbuf; 35 struct stat statbuf;
18 int mode; 36 int mode;
19 if (stat(s, &statbuf) < 0) return (0); 37 if (stat(s, &statbuf) < 0) return (0);
@@ -22,13 +40,14 @@ int sys_isreadablefile(const char *s)
22 if (S_ISDIR(mode)) return (0); 40 if (S_ISDIR(mode)) return (0);
23#endif 41#endif
24 return (1); 42 return (1);
43#endif /* ROCKBOX */
25} 44}
26 45
27 /* change '/' characters to the system's native file separator */ 46 /* change '/' characters to the system's native file separator */
28void sys_bashfilename(const char *from, char *to) 47void sys_bashfilename(const char *from, char *to)
29{ 48{
30 char c; 49 char c;
31 while (c = *from++) 50 while((c = *from++))
32 { 51 {
33#ifdef MSW 52#ifdef MSW
34 if (c == '/') c = '\\'; 53 if (c == '/') c = '\\';
@@ -43,7 +62,7 @@ void sys_bashfilename(const char *from, char *to)
43void sys_unbashfilename(const char *from, char *to) 62void sys_unbashfilename(const char *from, char *to)
44{ 63{
45 char c; 64 char c;
46 while (c = *from++) 65 while((c = *from++))
47 { 66 {
48#ifdef MSW 67#ifdef MSW
49 if (c == '\\') c = '/'; 68 if (c == '\\') c = '/';