Re: [hatari-devel] Character conversion for filenames in GEMDOS HD emulation |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Character conversion for filenames in GEMDOS HD emulation
- From: Max Böhm <mboehm3@xxxxxxxxx>
- Date: Tue, 15 Jul 2014 08:19:49 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Yiy50EXM52MPDplkZDuALpSYmK5O60NAyFSeWj8gsiY=; b=I6GQYoKzd45kzQlhkESe+j5gWwTU6htbJu/1Vvme4UjnXR1mnPHvxqPoU9Et2GGC59 DMVAakNLhc6ryixjVZCBm7Vy7Q17rGXDe+75CWEtPQx1rhX8LO6FDsUPKm1C6MOPrT05 6MKVxx5oTGtqYiwB64wg0HofLgmGTf1xtxGXgGhhnLrwEW21XrtD/x2sOcN37MwB4DiQ 14uiE9ybUZi8J1qWntrTdQ3oYBPm+lTtUFuTWOB/gSg3p4gMdWWkE6UYS1Djii+rZtb/ AYr/qQ8LEKHJpVm+rhRpSCLI9VNNOXWMD2Hh1HegtHs6LsSJ1DUyTqgzPppz2iMadhCZ 2z1w==
Hi Eero,
>> Here is a patch which integrates these functions into Hatari:
>> https://gist.github.com/a8b0ba0aa6d3bc8adab5
>
> Regarding this part of your patch:
> * ommented out because this is risky. When deleting files which
> * contain invalid characters, the inserted wildcard '?' may match
> * also on other files, and an arbitrary file may be deleted.
>
> What kind of use-case you had in mind?
>
> The file you get on emulated Atari and select to be deleted,
> should be the same that gets deleted. Tools that use wildcards
> for this kind of things are typically under MiNT, and that
> bypasses GEMDOS emulation.
To test the character conversion I have written a small program which
creates files with special characters:
#include <stdio.h>
#include <tos.h>
void main(void)
{
char name[20];
int i, fd, err;
Dcreate("C:\\TEST");
for (i=32; i<256; i++) {
sprintf(name, "C:\\TEST\\%c.TXT", i);
fd = Fcreate(name, 0);
err = fd<0;
if (!err)
err = Fclose(fd);
printf("%3d - '%s' - %s\n", i, name, err?"err":"ok");
}
exit(0);
}
When I run this on the emulated Atari, I get a file <character>.TXT for
each character (code 32..255) of the AtariST character set. Files which
special characters are displayed as "@.TXT" by the GEMDOS HD emulation.
When I now try to delete some of those files by dragging them into
the trash icon, the GEMDOS emulation replaces "@.TXT" by "?.TXT".
But this pattern matches on all files in the folder, so arbitrary files
are deleted.
With the character conversion patch the files won't be shown as "@.TXT"
in the first place and therefore I think the replacement by "?.TXT" to match
invalid characters will no longer be necessary.
Max