Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSRC file not reading correctly in Windows? #5

Open
micsthepick opened this issue Oct 20, 2019 · 2 comments
Open

RSRC file not reading correctly in Windows? #5

micsthepick opened this issue Oct 20, 2019 · 2 comments

Comments

@micsthepick
Copy link

for every .rsrc file I try to open, I get the following error:

rsrcfork.api.InvalidResourceFileError: The data offset (2134016) should point exactly to the end of the file header (256)

example file: https://drive.google.com/open?id=1gpn5mj5os0vwvXcfpVrtlCfs1WNkY_WU

@dgelessus
Copy link
Owner

The file that you've uploaded seems to be an AppleDouble file, not a resource file. AppleDouble files contain a file's resource fork (and some extra Macintosh metadata, like the type and creator code), but the format is not the same as a raw resource file, so the rsrcfork library cannot read them directly. You first need to extract the resource fork data from the AppleDouble file.

Unfortunately I don't know of any Windows tools that can extract the resource fork data from an AppleSingle/AppleDouble file. On Mac I use the command-line lsar and unar tools, but they won't help much in this case - when unar extracts resource forks, it can either create native OS X resource forks (which aren't an option on Windows) or AppleDouble files (which you already have)...

According to this guide from the Emaculation website, the Windows tool HFVExplorer can work with AppleDouble files. Perhaps it has an option to extract the resource data? I haven't tried it myself though, as I mostly work under OS X.

I might look into adding native support for AppleSingle/AppleDouble files into the rsrcfork library, or perhaps writing a separate library for handling the format. That should hopefully make it easier to access resource forks on non-Mac systems. It might take a while to implement this though, as I can't find any existing Python libraries for reading the AppleSingle/AppleDouble formats.

@sfuller
Copy link

sfuller commented Apr 8, 2021

I wrote some python that can parse AppleDouble format: https://gist.github.com/sfuller/720ea2ef5917ef6c6d20271b0bd56ce5
You can use it like this:

import appledouble
with open('double.rsrc', 'rb') as f:
    double = appledouble.parse(f)

You can then iterate through double.entries to find the resource_fork entry and pass the data of that entry into python-rsrcfork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants