Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/firmware/common/rbpaths.c b/firmware/common/rbpaths.c
- index 62a23e0..6d8bf37 100644
- --- a/firmware/common/rbpaths.c
- +++ b/firmware/common/rbpaths.c
- @@ -57,7 +57,7 @@ static bool try_path(const char* filename, unsigned flags)
- return false;
- }
- -const char* get_user_file_path(const char *path,
- +const char* _get_user_file_path(const char *path,
- unsigned flags,
- char* buf,
- const size_t bufsize)
- diff --git a/firmware/export/rbpaths.h b/firmware/export/rbpaths.h
- index cd87888..418d76b 100644
- --- a/firmware/export/rbpaths.h
- +++ b/firmware/export/rbpaths.h
- @@ -84,6 +84,20 @@ static inline __attribute__((always_inline)) const char* get_user_file_path(cons
- #define paths_init()
- #else /* application */
- +#ifndef PLUGIN
- +static inline __attribute__((always_inline)) const char* get_user_file_path(const char *path,
- + unsigned flags,
- + char* buf,
- + const size_t bufsize)
- +{
- + if (flags & FORCE_BUFFER_COPY)
- + {
- + strlcpy(buf, path, bufsize);
- + return buf;
- + }
- + return path;
- +}
- +#endif
- #define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rockbox/rocks"
- #define CODECS_DIR ROCKBOX_LIBRARY_PATH "/rockbox/codecs"
- @@ -92,7 +106,7 @@ static inline __attribute__((always_inline)) const char* get_user_file_path(cons
- #define PLAYLIST_CATALOG_DEFAULT_DIR ROCKBOX_DIR "/Playlists"
- extern void paths_init(void);
- -extern const char* get_user_file_path(const char *path,
- +extern const char* _get_user_file_path(const char *path,
- unsigned flags,
- char* buf,
- const size_t bufsize);
- diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c
- index 3591905..73f0c0f 100644
- --- a/uisimulator/common/io.c
- +++ b/uisimulator/common/io.c
- @@ -354,8 +354,17 @@ int sim_open(const char *name, int o, ...)
- {
- int opts = rockbox2sim(o);
- int ret;
- + char realpath[MAX_PATH];
- if (num_openfiles >= MAX_OPEN_FILES)
- return -2;
- +
- + if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN))
- + {
- + int flags = IS_FILE;
- + if (opts & (O_CREAT|O_RDWR))
- + flags |= NEED_WRITE;
- + name = _get_user_file_path(name, flags, realpath, sizeof(realpath));
- + }
- if (opts & O_CREAT)
- {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement