mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-04-13 15:37:05 +00:00
In extfs icon creation, ensure that the times on the host file are set correctly; actually allocate space for the other HInfo that set_finfo reads, such as the times
This commit is contained in:
parent
837c82d8b8
commit
8b44b00da3
@ -392,14 +392,23 @@ void init_posix_emu(void)
|
||||
int fd = my_creat( custom_icon_name, 0 );
|
||||
if(fd >= 0) {
|
||||
my_close(fd);
|
||||
struct my_stat custom_icon_stat;
|
||||
int stat_result = my_stat( custom_icon_name, &custom_icon_stat );
|
||||
fd = open_rfork( custom_icon_name, O_RDWR|O_CREAT );
|
||||
if(fd >= 0) {
|
||||
my_write( fd, my_comp_icon, sizeof(my_comp_icon) );
|
||||
my_close(fd);
|
||||
static uint8 host_finfo[SIZEOF_FInfo];
|
||||
// need room for the things from around the finfo that set_finfo reads
|
||||
static uint8 custom_icon_hfile[ioFlXFndrInfo + SIZEOF_FXInfo];
|
||||
memset(custom_icon_hfile, 0, ioFlXFndrInfo + SIZEOF_FXInfo);
|
||||
static uint8 * host_finfo = custom_icon_hfile + ioFlFndrInfo;
|
||||
uint32 finfo = Host2MacAddr(host_finfo);
|
||||
get_finfo(custom_icon_name, finfo, 0, false);
|
||||
WriteMacInt16(finfo + fdFlags, kIsInvisible);
|
||||
if (stat_result == 0) {
|
||||
WriteMacInt32(finfo - ioFlFndrInfo + ioFlCrDat, TimeToMacTime(custom_icon_stat.st_ctime));
|
||||
WriteMacInt32(finfo - ioFlFndrInfo + ioFlMdDat, TimeToMacTime(custom_icon_stat.st_mtime));
|
||||
}
|
||||
set_finfo(custom_icon_name, finfo, 0, false);
|
||||
get_finfo(my_computer, finfo, 0, true);
|
||||
WriteMacInt16(finfo + fdFlags, ReadMacInt16(finfo + fdFlags) | kHasCustomIcon);
|
||||
|
Loading…
x
Reference in New Issue
Block a user