- /* Take care of path standardization */
- if( *line != '/' && ((p_pos = strrchr( psz_cuefile, '/' ))
- || (p_pos = strrchr( psz_cuefile, '\\' ) )) )
- {
- psz_vcdfile = malloc( strlen(line) +
+ msg_Dbg( p_this,"guessing vcd image file: %s", psz_vcdfile );
+ p_vcddev->i_vcdimage_handle = utf8_open( psz_vcdfile,
+ O_RDONLY | O_NONBLOCK | O_BINARY, 0666 );
+
+ while( fgets( line, 1024, cuefile ) && !b_found )
+ {
+ /* We have a cue file, but no valid vcd file yet */
+ char filename[1024];
+ char type[16];
+ int i_temp = sscanf( line, "FILE \"%1023[^\"]\" %15s", filename, type );
+ *p_pos = 0;
+ switch( i_temp )
+ {
+ case 2:
+ msg_Dbg( p_this, "the cue file says the data file is %s", type );
+ if( strcasecmp( type, "BINARY" ) )
+ goto error; /* Error if not binary, otherwise treat as case 1 */
+ case 1:
+ if( p_vcddev->i_vcdimage_handle == -1 )
+ {
+ msg_Dbg( p_this, "we could not find the data file, but we found a new path" );
+ free( psz_vcdfile);
+ if( *filename != '/' && ((p_pos = strrchr( psz_cuefile, '/' ))
+ || (p_pos = strrchr( psz_cuefile, '\\' ) )) )
+ {
+ psz_vcdfile = malloc( strlen(filename) +