MiniVMac.cc: Preserve attributes when copying

When copying files from the system disk image to the new disk image,
preserve all attributes (creation date, modification date, bundle bit,
locked bit, etc.), except clear the inited bit so that the Finder
chooses new icon positions, otherwise (under System 6 at least) the
icons pile up on top of each other. Preserving the bundle bit in
particular tells the Finder to look in the file for icon information
when building the desktop database, without which the files all show
generic icons in the Finder.
This commit is contained in:
Ryan Schmidt 2022-10-06 17:11:32 -05:00
parent 280a1e4ac6
commit 14f5ad3728
1 changed files with 2 additions and 0 deletions

View File

@ -460,6 +460,8 @@ void MiniVMacLauncher::CopySystemFile(const std::string &fn, bool required)
hfs_setfork(out, 1);
hfs_read(in, buffer.data(), fileent.u.file.rsize);
hfs_write(out, buffer.data(), fileent.u.file.rsize);
fileent.fdflags &= ~HFS_FNDR_HASBEENINITED;
hfs_fsetattr(out, &fileent);
hfs_close(in);
hfs_close(out);
}