Skip to content

Commit

Permalink
fix: dylib parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbyg603 committed Oct 1, 2024
1 parent 339b76e commit 07013f7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 21 additions & 0 deletions spec/factory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,25 @@ describe('createMachoFiles', () => {
expect(expected.get(uuid)).toEqual(path);
}
});

describe("isFatOrMacho", () => {
it("should return true for fat file", async () =>
expectAsync(
isFatOrMacho(
"spec/support/bugsplat-ios.app/Frameworks/bugsplat.framework/HockeySDKResources.bundle/Contents/MacOS/HockeySDKResources"
)
).toBeResolvedTo(true));

it("should return true for macho file", async () =>
expectAsync(
isFatOrMacho(
"spec/support/bugsplat.app.dSYM/Contents/Resources/DWARF/bugsplat"
)
).toBeResolvedTo(true));

it("should return true for dylib file", async () =>
expectAsync(isFatOrMacho("spec/support/libggcurl.dylib")).toBeResolvedTo(
true
));
});
});
4 changes: 2 additions & 2 deletions src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ async function getUniqueMachoFiles(machoFiles: Array<MachoFile>): Promise<Array<
return Array.from(uniqueMachoFiles.values());
}

async function isFatOrMacho(path: string): Promise<boolean> {
return !extname(path) && (await MachoFile.isMacho(path) || await FatFile.isFat(path));
export async function isFatOrMacho(path: string): Promise<boolean> {
return (await MachoFile.isMacho(path) || await FatFile.isFat(path));
}

0 comments on commit 07013f7

Please sign in to comment.