Partiy implement long filename support

example filefilefile.txt can store now with cdmake
but not filefilefiles.txt have not check why it say not a iso9660 name 


svn path=/trunk/; revision=15301
This commit is contained in:
Magnus Olsen 2005-05-15 10:33:33 +00:00
parent ac178266c3
commit f20d4d059e

View file

@ -19,6 +19,10 @@
* - No Joliet file name validations
* - Very bad ISO file name generation
*
*
* convert long filename to iso9660 file name by Magnus Olsen
* magnus@greatlord.com
*
* $Id$
*/
@ -547,7 +551,8 @@ void parse_filename_into_dirrecord ( const char* filename, PDIR_RECORD d, BOOL d
char *t = d->name_on_cd;
char *n = d->name;
int joliet_length;
int filename_counter;
filename_counter = 1;
while (*s != 0)
{
if (*s == '.')
@ -559,7 +564,7 @@ void parse_filename_into_dirrecord ( const char* filename, PDIR_RECORD d, BOOL d
if ( (t-d->name_on_cd) < sizeof(d->name_on_cd)-1 )
*t++ = check_for_punctuation(*s, filename);
else if (!joliet)
error_exit ( "'%s' is not ISO-9660, aborting...", filename );
error_exit ("'%s' is not ISO-9660, aborting...", filename );
if ( (n-d->name) < sizeof(d->name)-1 )
*n++ = *s;
else if (!joliet)
@ -597,8 +602,26 @@ void parse_filename_into_dirrecord ( const char* filename, PDIR_RECORD d, BOOL d
} else
d->flags = 0;
if ( cdname_exists ( d ) )
error_exit ( "'%s' is a duplicate file name, aborting...", filename );
filename_counter = 1;
while ( cdname_exists ( d ) )
{
// the file name must be least 8 char long
if (strlen(d->name_on_cd)<8)
error_exit ( "'%s' is a duplicate file name, aborting...", filename );
if ((d->name_on_cd[8] == '.') && (strlen(d->name_on_cd) < 13))
error_exit ( "'%s' is a duplicate file name, aborting...", filename );
// max 255 times for equal short filename
if (filename_counter>255) error_exit ( "'%s' is a duplicate file name, aborting...", filename );
d->name_on_cd[8] = '~';
memset(&d->name_on_cd[9],0,5);
itoa(filename_counter, &d->name_on_cd[9],10);
filename_counter++;
}
if ( joliet )
{
@ -1641,4 +1664,5 @@ int main(int argc, char **argv)
return 0;
}
/* EOF */