Index: apps/recorder/recording.c =================================================================== --- apps/recorder/recording.c (revision 13496) +++ apps/recorder/recording.c (working copy) @@ -503,11 +503,18 @@ { char ext[16]; - if(global_settings.rec_directory) - getcwd(buffer, MAX_PATH); + if (global_settings.rec_directory[0] +#ifdef HAVE_HOTSWAP + && (hotswap_detect() || + !strchr(global_settings.rec_directory, '<')) +#endif + ) + { + strncpy(buffer, global_settings.rec_directory, MAX_PATH); + } else - strncpy(buffer, rec_base_directory, MAX_PATH); - + strncpy(buffer, REC_BASE_DIR, MAX_PATH); + snprintf(ext, sizeof(ext), ".%s", REC_FILE_ENDING(global_settings.rec_format)); @@ -524,26 +531,28 @@ int rec_create_directory(void) { int rc; + char *folder; + /* Try to create the base directory if needed */ + if (global_settings.rec_directory[0]) + folder = global_settings.rec_directory; + else + folder = REC_BASE_DIR; - /* Try to create the base directory if needed */ - if(global_settings.rec_directory == 0) + rc = mkdir(folder); + if(rc < 0 && errno != EEXIST) { - rc = mkdir(rec_base_directory); - if(rc < 0 && errno != EEXIST) - { - gui_syncsplash(HZ * 2, - "Can't create the %s directory. Error code %d.", - rec_base_directory, rc); - return -1; - } - else - { - /* If we have created the directory, we want the dir browser to - be refreshed even if we haven't recorded anything */ - if(errno != EEXIST) - return 1; - } + gui_syncsplash(HZ * 2, + "Can't create the %s directory. Error code %d.", + folder, rc); + return -1; } + else + { + /* If we have created the directory, we want the dir browser to + be refreshed even if we haven't recorded anything */ + if(errno != EEXIST) + return 1; + } return 0; } Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (revision 13496) +++ apps/lang/english.lang (working copy) @@ -10952,3 +10952,31 @@ *: "Time" + + id: LANG_SET_AS_REC_DIR + desc: + user: + + *: "Set As Recording Directory" + + + *: "Set As Recording Directory" + + + *: "Set As Recording Directory" + + + + id: LANG_CLEAR_REC_DIR + desc: + user: + + *: "Clear Recording Directory" + + + *: "Clear Recording Directory" + + + *: "Clear Recording Directory" + + Index: apps/settings.c =================================================================== --- apps/settings.c (revision 13496) +++ apps/settings.c (working copy) @@ -76,9 +76,6 @@ struct user_settings global_settings; struct system_status global_status; -#ifdef HAVE_RECORDING -const char rec_base_directory[] = REC_BASE_DIR; -#endif #if CONFIG_CODEC == SWCODEC #include "pcmbuf.h" #include "pcm_playback.h" Index: apps/onplay.c =================================================================== --- apps/onplay.c (revision 13496) +++ apps/onplay.c (working copy) @@ -1043,6 +1043,16 @@ MENUITEM_FUNCTION(set_backdrop_item, 0, ID2P(LANG_SET_AS_BACKDROP), set_backdrop, NULL, clipboard_callback, Icon_NOICON); #endif +#ifdef HAVE_RECORDING +static bool set_recdir(void) +{ + strncpy(global_settings.rec_directory, + selected_file, MAX_REC_DIR_PATH); + return false; +} +MENUITEM_FUNCTION(set_recdir_item, 0, ID2P(LANG_SET_AS_REC_DIR), + set_recdir, NULL, clipboard_callback, Icon_Recording); +#endif @@ -1090,6 +1100,10 @@ if ((this_item == &delete_dir_item) ) return action; +#ifdef HAVE_RECORDING + else if (this_item == &set_recdir_item) + return action; +#endif } else if (selected_file #ifdef HAVE_MULTIVOLUME @@ -1135,7 +1149,10 @@ #if LCD_DEPTH > 1 &set_backdrop_item, #endif - &list_viewers_item, &create_dir_item, &properties_item + &list_viewers_item, &create_dir_item, &properties_item, +#ifdef HAVE_RECORDING + &set_recdir_item, +#endif ); int onplay(char* file, int attr, int from) { Index: apps/settings.h =================================================================== --- apps/settings.h (revision 13496) +++ apps/settings.h (working copy) @@ -59,7 +59,7 @@ #define PLUGIN_DIR ROCKBOX_DIR "/rocks" #define VIEWERS_DIR ROCKBOX_DIR "/viewers" #define BACKDROP_DIR ROCKBOX_DIR "/backdrops" -#define REC_BASE_DIR "/recordings" +#define REC_BASE_DIR "/" #define EQS_DIR ROCKBOX_DIR "/eqs" #define CODECS_DIR ROCKBOX_DIR"/codecs" #define FMPRESET_PATH ROCKBOX_DIR "/fmpresets" @@ -69,8 +69,8 @@ #define FIXEDSETTINGSFILE ROCKBOX_DIR "/fixed.cfg" #define MAX_FILENAME 32 +#define MAX_REC_DIR_PATH 64 - #define BOOKMARK_NO 0 #define BOOKMARK_YES 1 #define BOOKMARK_ASK 2 @@ -169,6 +169,7 @@ /* show path types */ enum { SHOW_PATH_OFF = 0, SHOW_PATH_CURRENT, SHOW_PATH_FULL }; + /* Alarm settings */ #ifdef HAVE_RTC_ALARM enum { ALARM_START_WPS = 0, @@ -330,7 +331,7 @@ int crossfade_fade_out_duration; /* Fade out duration (0-15s) */ int crossfade_fade_out_mixmode; /* Fade out mode (0=crossfade,1=mix) */ #endif - +#ifdef HAVE_RECORDING #if CONFIG_CODEC == SWCODEC int rec_format; /* record format index */ #else @@ -364,7 +365,8 @@ int rec_split_method; /* time/filesize */ int rec_prerecord_time; /* In seconds, 0-30, 0 means OFF */ - int rec_directory; /* 0=base dir, 1=current dir */ + int rec_directory_choice; /* Recording directory enum above.*/ + char rec_directory[MAX_REC_DIR_PATH]; int cliplight; /* 0 = off 1 = main lcd 2 = main and remote lcd @@ -397,7 +399,7 @@ int rec_agc_maxgain_line; /* AGC maximum line-in gain */ int rec_agc_cliptime; /* 0.2, 0.4, 0.6, 0.8, 1s */ #endif - +#endif /* HAVE_RECORDING */ /* device settings */ #ifdef HAVE_LCD_CONTRAST @@ -727,8 +729,6 @@ /** global variables **/ extern long lasttime; -/* Recording base directory */ -extern const char rec_base_directory[]; /* global settings */ extern struct user_settings global_settings; /* global status */ Index: apps/menus/recording_menu.c =================================================================== --- apps/menus/recording_menu.c (revision 13496) +++ apps/menus/recording_menu.c (working copy) @@ -312,19 +312,16 @@ MENUITEM_SETTING(rec_prerecord_time, &global_settings.rec_prerecord_time, NULL); -static int recdirectory_func(void) + +static int clear_rec_directory(void) { - static const struct opt_items names[] = { - { rec_base_directory, -1 }, - { STR(LANG_RECORD_CURRENT_DIR) } - }; - return set_option(str(LANG_RECORD_DIRECTORY), - &global_settings.rec_directory, INT, - names, 2, NULL ); + global_settings.rec_directory[0] = '\0'; + gui_syncsplash(HZ, str(LANG_RESET_DONE_CLEAR)); + return false; } -MENUITEM_FUNCTION(recdirectory, 0, ID2P(LANG_RECORD_DIRECTORY), - recdirectory_func, NULL, NULL, Icon_Menu_setting); - +MENUITEM_FUNCTION(clear_rec_directory_item, 0, ID2P(LANG_CLEAR_REC_DIR), + clear_rec_directory, NULL, NULL, Icon_Folder); + MENUITEM_SETTING(cliplight, &global_settings.cliplight, NULL); #ifdef HAVE_AGC @@ -819,7 +816,7 @@ #endif &filesplitoptionsmenu, &rec_prerecord_time, - &recdirectory, + &clear_rec_directory_item, #ifdef HAVE_BACKLIGHT &cliplight, #endif Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (revision 13496) +++ apps/settings_list.c (working copy) @@ -756,8 +756,8 @@ INT_SETTING(0, rec_prerecord_time, LANG_RECORD_PRERECORD_TIME, 0, "prerecording time", UNIT_SEC, 0, 30, 1, rectime_formatter, rectime_getlang, NULL), - {F_T_INT,&global_settings.rec_directory,LANG_RECORD_DIRECTORY, - INT(0),"rec directory",REC_BASE_DIR ",current",UNUSED}, + FILENAME_SETTING(0, rec_directory, + "rec path", "", "", "", MAX_REC_DIR_PATH), #ifdef HAVE_BACKLIGHT CHOICE_SETTING(0, cliplight, LANG_CLIP_LIGHT, 0 , "cliplight", "off,main,both,remote", NULL, Index: apps/plugin.h =================================================================== --- apps/plugin.h (revision 13496) +++ apps/plugin.h (working copy) @@ -114,12 +114,12 @@ #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 57 +#define PLUGIN_API_VERSION 58 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define PLUGIN_MIN_API_VERSION 56 +#define PLUGIN_MIN_API_VERSION 58 /* plugin return codes */ enum plugin_status {