diff options
Diffstat (limited to 'uisimulator/common')
-rw-r--r-- | uisimulator/common/io.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index bdcc7e6ca1..260e880b62 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c | |||
@@ -40,9 +40,6 @@ | |||
40 | #include "dir-win32.h" | 40 | #include "dir-win32.h" |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #define MAX_PATH 260 | ||
44 | #define MAX_OPEN_FILES 11 | ||
45 | |||
46 | #include <fcntl.h> | 43 | #include <fcntl.h> |
47 | #include <SDL.h> | 44 | #include <SDL.h> |
48 | #include <SDL_thread.h> | 45 | #include <SDL_thread.h> |
@@ -52,7 +49,12 @@ | |||
52 | #include "config.h" | 49 | #include "config.h" |
53 | #include "ata.h" /* for IF_MV2 et al. */ | 50 | #include "ata.h" /* for IF_MV2 et al. */ |
54 | #include "thread-sdl.h" | 51 | #include "thread-sdl.h" |
52 | #include "rbpaths.h" | ||
55 | 53 | ||
54 | /* keep this in sync with file.h! */ | ||
55 | #undef MAX_PATH /* this avoids problems when building simulator */ | ||
56 | #define MAX_PATH 260 | ||
57 | #define MAX_OPEN_FILES 11 | ||
56 | 58 | ||
57 | /* Windows (and potentially other OSes) distinguish binary and text files. | 59 | /* Windows (and potentially other OSes) distinguish binary and text files. |
58 | * Define a dummy for the others. */ | 60 | * Define a dummy for the others. */ |
@@ -255,7 +257,7 @@ static ssize_t io_trigger_and_wait(int cmd) | |||
255 | return result; | 257 | return result; |
256 | } | 258 | } |
257 | 259 | ||
258 | #ifndef __PCTOOL__ | 260 | #if !defined(__PCTOOL__) && !defined(APPLICATION) |
259 | static const char *get_sim_pathname(const char *name) | 261 | static const char *get_sim_pathname(const char *name) |
260 | { | 262 | { |
261 | static char buffer[MAX_PATH]; /* sufficiently big */ | 263 | static char buffer[MAX_PATH]; /* sufficiently big */ |
@@ -520,7 +522,6 @@ int sim_fsync(int fd) | |||
520 | void *sim_codec_load_ram(char* codecptr, int size, void **pd) | 522 | void *sim_codec_load_ram(char* codecptr, int size, void **pd) |
521 | { | 523 | { |
522 | void *hdr; | 524 | void *hdr; |
523 | char name[MAX_PATH]; | ||
524 | char path[MAX_PATH]; | 525 | char path[MAX_PATH]; |
525 | int fd; | 526 | int fd; |
526 | int codec_count; | 527 | int codec_count; |
@@ -536,8 +537,9 @@ void *sim_codec_load_ram(char* codecptr, int size, void **pd) | |||
536 | to find an unused filename */ | 537 | to find an unused filename */ |
537 | for (codec_count = 0; codec_count < 10; codec_count++) | 538 | for (codec_count = 0; codec_count < 10; codec_count++) |
538 | { | 539 | { |
539 | snprintf(name, sizeof(name), "/_temp_codec%d.dll", codec_count); | 540 | char name[MAX_PATH]; |
540 | snprintf(path, sizeof(path), "%s", get_sim_pathname(name)); | 541 | const char *_name = get_user_file_path(ROCKBOX_DIR, 0, name, sizeof(name)); |
542 | snprintf(path, sizeof(path), "%s/_temp_codec%d.dll", get_sim_pathname(_name), codec_count); | ||
541 | fd = OPEN(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU); | 543 | fd = OPEN(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU); |
542 | if (fd >= 0) | 544 | if (fd >= 0) |
543 | break; /* Created a file ok */ | 545 | break; /* Created a file ok */ |