Re: [hatari-devel] Maybe a gemdos bug, I don't know |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Hi,
On torstai 14 kesäkuu 2012, Laurent Sallafranque wrote:
> > What I could do, is adding a warning on console for names that are
> > longer
>
> than 8+3 characters. Would that help?
>
> If there's no better solution, it would be good to add this warning.
Could you send the test program to me or test the attached path?
- Eero
>
> Best regards
> Laurent
>
> Le 13/06/2012 22:53, Eero Tamminen a écrit :
> > Hi,
> >
> > On keskiviikko 13 kesäkuu 2012, Laurent Sallafranque wrote:
> >> While playing with hatari and asm, I think I4ve found something :
> >>
> >> In my program, I have the following :
> >>
> >> toto_01l: dc.b "DATA\CHARS\TOTO0\BIN_LEFT\IDLE1.SPR",0
> >> toto_01r: dc.b "DATA\CHARS\TOTO0\BIN_RIGHT\IDLE1.SPR",0
> >>
> >>
> >> I load these files with the loader.s rout from DHS (thanks to them for
> >> this code).
> >>
> >> On hatari, it loads well and I don't have any problem, while on my
> >> real falcon, I get the following message :
> >>
> >> DATA\CHARS\TOTO0\BIN_RIGHT\IDLE1.SPR not found
> >>
> >> I think this may due to the 9 characters of the directory, but hatari
> >> and my Falcon don't behave the same here.
> >
> > That's a side-effect of Hatari GEMDOS emulation convenience feature.
> >
> > Hatari's GEMDOS emulation supports accessing (case insensitively) host
> > directories and files which names are longer than 8+3 supported by FAT.
> >
> > Even if one part of the code would limit names coming from TOS to
> > GEMDOS emulation to 8+3, the support for host names longer than 8+3
> > names would cause the longer names to be matched.
> >
> >
> > What I could do, is adding a warning on console for names that are
> > longer than 8+3 characters. Would that help?
> >
> > - Eero
diff -r dffd611d2de7 src/gemdos.c
--- a/src/gemdos.c Sat Jun 16 11:21:11 2012 +0300
+++ b/src/gemdos.c Mon Jun 18 23:37:19 2012 +0300
@@ -1046,6 +1046,28 @@
*dst = '\0';
}
+/**
+ * Give warning if dir/filename exceeds 8+3 as that wouldn't be
+ * valid for TOS.
+ */
+static void check_tos_len(const char *path)
+{
+ char *dot;
+
+ dot = strchr(path, '.');
+ if (dot)
+ {
+ if (dot-path <= 8 && strlen(dot+1) <= 3)
+ return;
+ }
+ else
+ {
+ if (strlen(path) <= 8)
+ return;
+ }
+ Log_Printf(LOG_WARN, "GEMDOS path component '%s' doesn't fit to 8+3 chars!\n", path);
+}
+
/*-----------------------------------------------------------------------*/
/**
* Use hard-drive directory, current ST directory and filename
@@ -1165,6 +1187,8 @@
/* and advance filename */
filename = s;
+ check_tos_len(dirname);
+
if (strchr(dirname, '?') || strchr(dirname, '*'))
Log_Printf(LOG_WARN, "GEMDOS dir name '%s' with wildcards in %s!\n", dirname, pszFileName);
@@ -1184,6 +1208,8 @@
if (*filename)
{
+ check_tos_len(filename);
+
/* a wildcard instead of a complete file name? */
if (strchr(filename,'?') || strchr(filename,'*'))
{