summaryrefslogtreecommitdiff
path: root/apps/recorder/recording.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-06-04 12:34:29 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-06-04 12:34:29 +0000
commit3405d1302073ab7fa1ae7913d9e27c64133b7d78 (patch)
tree00000c7cfc15856dc7400e37de72d1de4d8caa7e /apps/recorder/recording.c
parent313f67651fd964367538d3ee0213d6796e90d0e9 (diff)
downloadrockbox-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/recorder/recording.c')
-rw-r--r--apps/recorder/recording.c47
1 files changed, 28 insertions, 19 deletions
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
140int 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
140bool recording_screen(void) 166bool 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 {