Remove AppleDouble resource fork files from font_files
Files starting with _ that are AppleDouble metadata (not real fonts) were being included in casks, causing Font Book issues. Deleted 57 such files from font_files/ and added detection to the cleanup script to prevent them in the future. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c85bbccd26
commit
7948c86aa0
60 changed files with 17 additions and 31 deletions
|
|
@ -33,11 +33,26 @@ class FontFolderCleaner:
|
|||
|
||||
def move_file_to_correct_directory(self, file_path, folder_path):
|
||||
"""Move file to the appropriate subdirectory."""
|
||||
if file_path.name == '.DS_Store':
|
||||
if file_path.name == '.DS_Store' or file_path.name.startswith('._'):
|
||||
file_path.unlink()
|
||||
print(f"Removed .DS_Store file: {file_path}")
|
||||
print(f"Removed macOS metadata file: {file_path}")
|
||||
return
|
||||
|
||||
# Remove AppleDouble resource fork files (start with _ and aren't real fonts)
|
||||
if file_path.name.startswith('_') and file_path.suffix.lower() in (
|
||||
'.ttf', '.otf', '.ttc', '.woff', '.woff2', '.eot', '.svg',
|
||||
):
|
||||
# Check if it's an AppleDouble file by reading magic bytes
|
||||
try:
|
||||
with open(file_path, 'rb') as f:
|
||||
magic = f.read(4)
|
||||
if magic == b'\x00\x05\x16\x07': # AppleDouble magic number
|
||||
file_path.unlink()
|
||||
print(f"Removed AppleDouble resource fork: {file_path}")
|
||||
return
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
target_dir = self.get_target_directory(file_path)
|
||||
target_path = folder_path / target_dir / file_path.name
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue