Advertisement
Guest User

Untitled

a guest
Oct 18th, 2010
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. diff --git a/firmware/common/rbpaths.c b/firmware/common/rbpaths.c
  2. index 62a23e0..6d8bf37 100644
  3. --- a/firmware/common/rbpaths.c
  4. +++ b/firmware/common/rbpaths.c
  5. @@ -57,7 +57,7 @@ static bool try_path(const char* filename, unsigned flags)
  6. return false;
  7. }
  8.  
  9. -const char* get_user_file_path(const char *path,
  10. +const char* _get_user_file_path(const char *path,
  11. unsigned flags,
  12. char* buf,
  13. const size_t bufsize)
  14. diff --git a/firmware/export/rbpaths.h b/firmware/export/rbpaths.h
  15. index cd87888..418d76b 100644
  16. --- a/firmware/export/rbpaths.h
  17. +++ b/firmware/export/rbpaths.h
  18. @@ -84,6 +84,20 @@ static inline __attribute__((always_inline)) const char* get_user_file_path(cons
  19.  
  20. #define paths_init()
  21. #else /* application */
  22. +#ifndef PLUGIN
  23. +static inline __attribute__((always_inline)) const char* get_user_file_path(const char *path,
  24. + unsigned flags,
  25. + char* buf,
  26. + const size_t bufsize)
  27. +{
  28. + if (flags & FORCE_BUFFER_COPY)
  29. + {
  30. + strlcpy(buf, path, bufsize);
  31. + return buf;
  32. + }
  33. + return path;
  34. +}
  35. +#endif
  36.  
  37. #define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rockbox/rocks"
  38. #define CODECS_DIR ROCKBOX_LIBRARY_PATH "/rockbox/codecs"
  39. @@ -92,7 +106,7 @@ static inline __attribute__((always_inline)) const char* get_user_file_path(cons
  40. #define PLAYLIST_CATALOG_DEFAULT_DIR ROCKBOX_DIR "/Playlists"
  41.  
  42. extern void paths_init(void);
  43. -extern const char* get_user_file_path(const char *path,
  44. +extern const char* _get_user_file_path(const char *path,
  45. unsigned flags,
  46. char* buf,
  47. const size_t bufsize);
  48. diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c
  49. index 3591905..73f0c0f 100644
  50. --- a/uisimulator/common/io.c
  51. +++ b/uisimulator/common/io.c
  52. @@ -354,8 +354,17 @@ int sim_open(const char *name, int o, ...)
  53. {
  54. int opts = rockbox2sim(o);
  55. int ret;
  56. + char realpath[MAX_PATH];
  57. if (num_openfiles >= MAX_OPEN_FILES)
  58. return -2;
  59. +
  60. + if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN))
  61. + {
  62. + int flags = IS_FILE;
  63. + if (opts & (O_CREAT|O_RDWR))
  64. + flags |= NEED_WRITE;
  65. + name = _get_user_file_path(name, flags, realpath, sizeof(realpath));
  66. + }
  67.  
  68. if (opts & O_CREAT)
  69. {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement