summaryrefslogtreecommitdiff
path: root/apps/filetypes.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-08-06 13:42:52 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-08-06 13:42:52 +0000
commitfda7d720c05b4a756f045e0c0f4afe9630edb5c5 (patch)
tree35bb19611d47bcb05a49529a73ccc5d66a50476e /apps/filetypes.c
parent5b76936a44de3c7ecd568300f26b5e6421901285 (diff)
downloadrockbox-fda7d720c05b4a756f045e0c0f4afe9630edb5c5.tar.gz
rockbox-fda7d720c05b4a756f045e0c0f4afe9630edb5c5.zip
Accept FS#5464 - organise the rocks directory.
If any plugins or "open with" optoins dont work please let me know... git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14214 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/filetypes.c')
-rw-r--r--apps/filetypes.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 7590b1b3e7..973f60e6e5 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -119,7 +119,6 @@ void tree_get_filetypes(const struct filetype** types, int* count)
119 119
120struct file_type { 120struct file_type {
121 int icon; /* the icon which shall be used for it, NOICON if unknown */ 121 int icon; /* the icon which shall be used for it, NOICON if unknown */
122 bool viewer; /* true if the rock is in viewers, false if in rocks */
123 unsigned char attr; /* FILETYPES_MASK >> 8 */ 122 unsigned char attr; /* FILETYPES_MASK >> 8 */
124 char* plugin; /* Which plugin to use, NULL if unknown, or builtin */ 123 char* plugin; /* Which plugin to use, NULL if unknown, or builtin */
125 char* extension; /* NULL for none */ 124 char* extension; /* NULL for none */
@@ -289,7 +288,6 @@ static void read_config(char* config_file)
289{ 288{
290 char line[64], *s, *e; 289 char line[64], *s, *e;
291 char extension[8], plugin[32]; 290 char extension[8], plugin[32];
292 bool viewer;
293 int fd = open(config_file, O_RDONLY); 291 int fd = open(config_file, O_RDONLY);
294 if (fd < 0) 292 if (fd < 0)
295 return; 293 return;
@@ -314,24 +312,15 @@ static void read_config(char* config_file)
314 312
315 /* get the plugin */ 313 /* get the plugin */
316 s = e+1; 314 s = e+1;
317 e = strchr(s, '/');
318 if (!e)
319 continue;
320 *e = '\0';
321 if (!strcasecmp("viewers", s))
322 viewer = true;
323 else
324 viewer = false;
325 s = e+1;
326 e = strchr(s, ','); 315 e = strchr(s, ',');
327 if (!e) 316 if (!e)
328 continue; 317 continue;
329 *e = '\0'; 318 *e = '\0';
319
330 strcpy(plugin, s); 320 strcpy(plugin, s);
331 /* ok, store this plugin/extension, check icon after */ 321 /* ok, store this plugin/extension, check icon after */
332 filetypes[filetype_count].extension = filetypes_strdup(extension); 322 filetypes[filetype_count].extension = filetypes_strdup(extension);
333 filetypes[filetype_count].plugin = filetypes_strdup(plugin); 323 filetypes[filetype_count].plugin = filetypes_strdup(plugin);
334 filetypes[filetype_count].viewer = viewer;
335 filetypes[filetype_count].attr = heighest_attr +1; 324 filetypes[filetype_count].attr = heighest_attr +1;
336 filetypes[filetype_count].icon = Icon_Questionmark; 325 filetypes[filetype_count].icon = Icon_Questionmark;
337 heighest_attr++; 326 heighest_attr++;
@@ -422,8 +411,7 @@ char* filetype_get_plugin(const struct entry* file)
422 if (filetypes[index].plugin == NULL) 411 if (filetypes[index].plugin == NULL)
423 return NULL; 412 return NULL;
424 snprintf(plugin_name, MAX_PATH, "%s/%s.%s", 413 snprintf(plugin_name, MAX_PATH, "%s/%s.%s",
425 filetypes[index].viewer? VIEWERS_DIR: PLUGIN_DIR, 414 PLUGIN_DIR, filetypes[index].plugin, ROCK_EXTENSION);
426 filetypes[index].plugin, ROCK_EXTENSION);
427 return plugin_name; 415 return plugin_name;
428} 416}
429 417