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
Modified: trunk/reactos/tools/cdmake/cdmake.c
_____
Modified: trunk/reactos/tools/cdmake/cdmake.c
--- trunk/reactos/tools/cdmake/cdmake.c 2005-05-15 09:55:56 UTC (rev
15300)
+++ trunk/reactos/tools/cdmake/cdmake.c 2005-05-15 10:33:33 UTC (rev
15301)
@@ -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(a)greatlord.com
+ *
* $Id$
*/
@@ -546,8 +550,9 @@
const char *s = filename;
char *t = d->name_on_cd;
char *n = d->name;
- int joliet_length;
-
+ int joliet_length;
+ int filename_counter;
+ filename_counter = 1;
while (*s != 0)
{
if (*s == '.')
@@ -555,11 +560,11 @@
s++;
break;
}
-
+
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,9 +602,27 @@
} 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 )
{
joliet_length = strlen(filename);
@@ -1641,4 +1664,5 @@
return 0;
}
+
/* EOF */
Show replies by date