From 04b3435afd032766a8ac93b2904166499e62c7a4 Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Mon, 10 Sep 2007 09:46:36 +0000 Subject: Clean up hard-coded paths git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14662 a1c6a512-1295-4272-9138-f99709370657 --- apps/logfdisp.c | 2 +- apps/plugins/calendar.c | 10 +++++----- apps/plugins/lib/configfile.c | 2 +- apps/plugins/midi/synth.c | 4 ++-- apps/plugins/midi2wav.c | 3 ++- apps/plugins/midiplay.c | 3 ++- apps/plugins/pacbox/pacbox.c | 4 ++-- apps/plugins/rockboy/menu.c | 2 +- apps/plugins/rockboy/rockmacros.h | 2 +- apps/plugins/snake2.c | 2 +- apps/plugins/zxbox/snapshot.c | 2 +- 11 files changed, 19 insertions(+), 17 deletions(-) diff --git a/apps/logfdisp.c b/apps/logfdisp.c index 734a6aec63..6463ae6d88 100644 --- a/apps/logfdisp.c +++ b/apps/logfdisp.c @@ -108,7 +108,7 @@ bool logfdump(void) /* nothing is logged just yet */ return false; - fd = open("/.rockbox/logf.txt", O_CREAT|O_WRONLY|O_TRUNC); + fd = open(ROCKBOX_DIR "/logf.txt", O_CREAT|O_WRONLY|O_TRUNC); if(-1 != fd) { unsigned char buffer[MAX_LOGF_ENTRY +1]; int index = logfindex-1; diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 8c0b6af5b9..8ed6122c3f 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c @@ -218,7 +218,7 @@ static void load_memo(struct shown *shown) for (k = 0; k < 7; k++) wday_has_memo[k] = false; memos_in_memory = 0; - fp = rb->open("/.rockbox/.memo",O_RDONLY); + fp = rb->open(ROCKBOX_DIR "/.memo",O_RDONLY); if (fp > -1) { int count = rb->filesize(fp); @@ -315,8 +315,8 @@ static void load_memo(struct shown *shown) static bool save_memo(int changed, bool new_mod, struct shown *shown) { int fp,fq; - fp = rb->open("/.rockbox/.memo",O_RDONLY | O_CREAT); - fq = rb->creat("/.rockbox/~temp"); + fp = rb->open(ROCKBOX_DIR "/.memo",O_RDONLY | O_CREAT); + fq = rb->creat(ROCKBOX_DIR "/~temp"); if ( (fq != -1) && (fp != -1) ) { int i; @@ -345,7 +345,7 @@ static bool save_memo(int changed, bool new_mod, struct shown *shown) rb->write(fq,temp,1); } rb->close(fp); - fp = rb->creat("/.rockbox/.memo"); + fp = rb->creat(ROCKBOX_DIR "/.memo"); rb->lseek(fp, 0, SEEK_SET); rb->lseek(fq, 0, SEEK_SET); for (i = 0; i < rb->filesize(fq); i++) @@ -355,7 +355,7 @@ static bool save_memo(int changed, bool new_mod, struct shown *shown) } rb->close(fp); rb->close(fq); - rb->remove("/.rockbox/~temp"); + rb->remove(ROCKBOX_DIR "/~temp"); load_memo(shown); return true; } diff --git a/apps/plugins/lib/configfile.c b/apps/plugins/lib/configfile.c index 54c067c4a7..0fbba81580 100644 --- a/apps/plugins/lib/configfile.c +++ b/apps/plugins/lib/configfile.c @@ -33,7 +33,7 @@ void get_cfg_filename(char* buf, int buf_len, const char* filename) s = cfg_rb->strrchr(buf, '/'); if (!s) /* should never happen */ { - cfg_rb->snprintf(buf, buf_len, "/.rockbox/rocks/%s", filename); + cfg_rb->snprintf(buf, buf_len, PLUGIN_DIR "/%s", filename); } else { diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c index 6ec229b4bf..00a01e41cb 100644 --- a/apps/plugins/midi/synth.c +++ b/apps/plugins/midi/synth.c @@ -131,7 +131,7 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig) while(readChar(file)!=' ' && !eof(file)); readTextBlock(file, name); - rb->snprintf(fn, 40, "/.rockbox/patchset/%s.pat", name); + rb->snprintf(fn, 40, ROCKBOX_DIR "/patchset/%s.pat", name); /* printf("\nLOADING: <%s> ", fn); */ if(patchUsed[a]==1) @@ -162,7 +162,7 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig) { readTextBlock(file, number); readTextBlock(file, name); - rb->snprintf(fn, 40, "/.rockbox/patchset/%s.pat", name); + rb->snprintf(fn, 40, ROCKBOX_DIR "/patchset/%s.pat", name); idx = rb->atoi(number); if(idx == 0) diff --git a/apps/plugins/midi2wav.c b/apps/plugins/midi2wav.c index 368c8b9125..ad41451d88 100644 --- a/apps/plugins/midi2wav.c +++ b/apps/plugins/midi2wav.c @@ -107,7 +107,8 @@ int midimain(void * filename) struct MIDIfile * mf = loadFile(filename); rb->splash(HZ/5, "LOADING PATCHES"); - if (initSynth(mf, "/.rockbox/patchset/patchset.cfg", "/.rockbox/patchset/drums.cfg") == -1) + if (initSynth(mf, ROCKBOX_DIR "/patchset/patchset.cfg", + ROCKBOX_DIR "/patchset/drums.cfg") == -1) { return -1; } diff --git a/apps/plugins/midiplay.c b/apps/plugins/midiplay.c index c19ca04806..59594a97f7 100644 --- a/apps/plugins/midiplay.c +++ b/apps/plugins/midiplay.c @@ -237,7 +237,8 @@ int midimain(void * filename) return -1; } - if (initSynth(mf, "/.rockbox/patchset/patchset.cfg", "/.rockbox/patchset/drums.cfg") == -1) + if (initSynth(mf, ROCKBOX_DIR "/patchset/patchset.cfg", + ROCKBOX_DIR "/patchset/drums.cfg") == -1) return -1; //#ifndef SIMULATOR diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c index 712c3aff77..fad27358d2 100644 --- a/apps/plugins/pacbox/pacbox.c +++ b/apps/plugins/pacbox/pacbox.c @@ -68,7 +68,7 @@ static bool loadFile( const char * name, unsigned char * buf, int len ) { char filename[MAX_PATH]; - rb->snprintf(filename,sizeof(filename),"/.rockbox/pacman/%s",name); + rb->snprintf(filename,sizeof(filename), ROCKBOX_DIR "/pacman/%s",name); int fd = rb->open( filename, O_RDONLY); @@ -419,7 +419,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) SETTINGS_VERSION); } } else { - rb->splash(HZ*2, "No ROMs in /.rockbox/pacman/"); + rb->splash(HZ*2, "No ROMs in %s/pacman/", ROCKBOX_DIR); } #ifdef HAVE_ADJUSTABLE_CPU_FREQ diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c index 0c9e46bbdf..e896e26c20 100644 --- a/apps/plugins/rockboy/menu.c +++ b/apps/plugins/rockboy/menu.c @@ -35,7 +35,7 @@ static void do_slot_menu(bool is_load); static void munge_name(char *buf, size_t bufsiz); /* directory ROM save slots belong in */ -#define STATE_DIR "/.rockbox/rockboy" +#define STATE_DIR ROCKBOX_DIR "/rockboy" int getbutton(char *text) { diff --git a/apps/plugins/rockboy/rockmacros.h b/apps/plugins/rockboy/rockmacros.h index 83b599897e..01beb43fb5 100644 --- a/apps/plugins/rockboy/rockmacros.h +++ b/apps/plugins/rockboy/rockmacros.h @@ -121,6 +121,6 @@ struct options { bool plugbuf; extern struct options options; -#define savedir "/.rockbox/rockboy" +#define savedir ROCKBOX_DIR "/rockboy" #endif diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c index dbefef6b7b..385af159e4 100644 --- a/apps/plugins/snake2.c +++ b/apps/plugins/snake2.c @@ -370,7 +370,7 @@ int load_all_levels(void) return 0; } -/*Hi-Score reading and writing to file "/.rockbox/snake2.levels" function */ +/*Hi-Score reading and writing to file "/.rockbox/rocks/games/snake2.levels" function */ void iohiscore(void) { int fd; diff --git a/apps/plugins/zxbox/snapshot.c b/apps/plugins/zxbox/snapshot.c index d693d1f6b8..0010550392 100644 --- a/apps/plugins/zxbox/snapshot.c +++ b/apps/plugins/zxbox/snapshot.c @@ -37,7 +37,7 @@ #define COMPRESS_SAVE 1 -static char quick_snap_file[]="/.rockbox/zxboxq.z80"; +static char quick_snap_file[]= ROCKBOX_DIR "/zxboxq.z80"; typedef struct { int isfile; -- cgit v1.2.3