diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-06-04 12:34:29 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-06-04 12:34:29 +0000 |
commit | 3405d1302073ab7fa1ae7913d9e27c64133b7d78 (patch) | |
tree | 00000c7cfc15856dc7400e37de72d1de4d8caa7e /apps | |
parent | 313f67651fd964367538d3ee0213d6796e90d0e9 (diff) | |
download | rockbox-3405d1302073ab7fa1ae7913d9e27c64133b7d78.tar.gz rockbox-3405d1302073ab7fa1ae7913d9e27c64133b7d78.zip |
The /recordings directory is now automatically created in the radio screen as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4721 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/recorder/radio.c | 3 | ||||
-rw-r--r-- | apps/recorder/recording.c | 47 | ||||
-rw-r--r-- | apps/recorder/recording.h | 1 |
3 files changed, 32 insertions, 19 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index af39124b9b..feea3fa5f2 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -155,6 +155,9 @@ bool radio_screen(void) | |||
155 | 155 | ||
156 | radio_load_presets(); | 156 | radio_load_presets(); |
157 | 157 | ||
158 | if(rec_create_directory() > 0) | ||
159 | have_recorded = true; | ||
160 | |||
158 | mpeg_stop(); | 161 | mpeg_stop(); |
159 | 162 | ||
160 | mpeg_init_recording(); | 163 | mpeg_init_recording(); |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 1a0215e5e2..2cef11ae13 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -137,6 +137,32 @@ char *rec_create_filename(char *buffer) | |||
137 | return buffer; | 137 | return buffer; |
138 | } | 138 | } |
139 | 139 | ||
140 | int rec_create_directory(void) | ||
141 | { | ||
142 | int rc; | ||
143 | |||
144 | /* Try to create the base directory if needed */ | ||
145 | if(global_settings.rec_directory == 0) | ||
146 | { | ||
147 | rc = mkdir(rec_base_directory, 0); | ||
148 | if(rc < 0 && errno != EEXIST) | ||
149 | { | ||
150 | splash(HZ * 2, true, | ||
151 | "Can't create the %s directory. Error code %d.", | ||
152 | rec_base_directory, rc); | ||
153 | return -1; | ||
154 | } | ||
155 | else | ||
156 | { | ||
157 | /* If we have created the directory, we want the dir browser to | ||
158 | be refreshed even if we haven't recorded anything */ | ||
159 | if(errno != EEXIST) | ||
160 | return 1; | ||
161 | } | ||
162 | } | ||
163 | return 0; | ||
164 | } | ||
165 | |||
140 | bool recording_screen(void) | 166 | bool recording_screen(void) |
141 | { | 167 | { |
142 | int button; | 168 | int button; |
@@ -152,7 +178,6 @@ bool recording_screen(void) | |||
152 | unsigned int last_seconds = 0; | 178 | unsigned int last_seconds = 0; |
153 | int hours, minutes; | 179 | int hours, minutes; |
154 | char path_buffer[MAX_PATH]; | 180 | char path_buffer[MAX_PATH]; |
155 | int rc; | ||
156 | bool been_in_usb_mode = false; | 181 | bool been_in_usb_mode = false; |
157 | 182 | ||
158 | cursor = 0; | 183 | cursor = 0; |
@@ -183,24 +208,8 @@ bool recording_screen(void) | |||
183 | lcd_getstringsize("M", &w, &h); | 208 | lcd_getstringsize("M", &w, &h); |
184 | lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8); | 209 | lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8); |
185 | 210 | ||
186 | /* Try to create the base directory if needed */ | 211 | if(rec_create_directory() > 0) |
187 | if(global_settings.rec_directory == 0) | 212 | have_recorded = true; |
188 | { | ||
189 | rc = mkdir(rec_base_directory, 0); | ||
190 | if(rc < 0 && errno != EEXIST) | ||
191 | { | ||
192 | splash(HZ * 2, true, | ||
193 | "Can't create the %s directory. Error code %d.", | ||
194 | rec_base_directory, rc); | ||
195 | } | ||
196 | else | ||
197 | { | ||
198 | /* If we have created the directory, we want the dir browser to | ||
199 | be refreshed even if we haven't recorded anything */ | ||
200 | if(errno != EEXIST) | ||
201 | have_recorded = true; | ||
202 | } | ||
203 | } | ||
204 | 213 | ||
205 | while(!done) | 214 | while(!done) |
206 | { | 215 | { |
diff --git a/apps/recorder/recording.h b/apps/recorder/recording.h index 174621b3b7..384b34f5bf 100644 --- a/apps/recorder/recording.h +++ b/apps/recorder/recording.h | |||
@@ -21,5 +21,6 @@ | |||
21 | 21 | ||
22 | bool recording_screen(void); | 22 | bool recording_screen(void); |
23 | char *rec_create_filename(char *buf); | 23 | char *rec_create_filename(char *buf); |
24 | int rec_create_directory(void); | ||
24 | 25 | ||
25 | #endif | 26 | #endif |