Skip to content

Commit

Permalink
Merge pull request #78319 from bruvzg/fix_lipo_fa
Browse files Browse the repository at this point in the history
[macOS export] Fix lipo file handling.
  • Loading branch information
akien-mga committed Jun 16, 2023
2 parents ada10b5 + c7f4e3f commit 5983785
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions platform/macos/export/lipo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,27 @@ bool LipO::create_file(const String &p_output_path, const PackedStringArray &p_f

uint64_t max_size = 0;
for (int i = 0; i < p_files.size(); i++) {
MachO mh;
if (!mh.open_file(p_files[i])) {
ERR_FAIL_V_MSG(false, vformat("LipO: Invalid MachO file: \"%s.\"", p_files[i]));
}
{
MachO mh;
if (!mh.open_file(p_files[i])) {
ERR_FAIL_V_MSG(false, vformat("LipO: Invalid MachO file: \"%s\".", p_files[i]));
}

FatArch arch;
arch.cputype = mh.get_cputype();
arch.cpusubtype = mh.get_cpusubtype();
arch.offset = 0;
arch.size = mh.get_size();
arch.align = mh.get_align();
max_size += arch.size;
FatArch arch;
arch.cputype = mh.get_cputype();
arch.cpusubtype = mh.get_cpusubtype();
arch.offset = 0;
arch.size = mh.get_size();
arch.align = mh.get_align();
max_size += arch.size;

archs.push_back(arch);
archs.push_back(arch);
}

Ref<FileAccess> fb = FileAccess::open(p_files[i], FileAccess::READ);
if (fb.is_null()) {
close();
ERR_FAIL_V_MSG(false, vformat("LipO: Can't open file: \"%s.\"", p_files[i]));
ERR_FAIL_V_MSG(false, vformat("LipO: Can't open file: \"%s\".", p_files[i]));
}
}

Expand Down Expand Up @@ -100,7 +102,7 @@ bool LipO::create_file(const String &p_output_path, const PackedStringArray &p_f
Ref<FileAccess> fb = FileAccess::open(p_files[i], FileAccess::READ);
if (fb.is_null()) {
close();
ERR_FAIL_V_MSG(false, vformat("LipO: Can't open file: \"%s.\"", p_files[i]));
ERR_FAIL_V_MSG(false, vformat("LipO: Can't open file: \"%s\".", p_files[i]));
}
uint64_t cur = fa->get_position();
for (uint64_t j = cur; j < archs[i].offset; j++) {
Expand Down

0 comments on commit 5983785

Please sign in to comment.