### Install Executable Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/dmg/CMakeLists.txt Installs the 'dmg-bin' executable to the 'bin' directory on the target system. ```cmake install(TARGETS dmg-bin DESTINATION bin) ``` -------------------------------- ### Define HFS+ Executable and Installation Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/hfs/CMakeLists.txt This snippet defines the 'hfsplus' executable target, linking it against the 'hfs' library. It also specifies that the 'hfsplus' executable should be installed to the 'bin' directory. ```cmake add_executable(hfsplus hfs.c) target_link_libraries (hfsplus hfs) install(TARGETS hfsplus DESTINATION bin) ``` -------------------------------- ### Set Minimum CMake Version and Project Name Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/CMakeLists.txt Specifies the minimum required CMake version and defines the project name. This is a standard starting point for any CMake build script. ```cmake cmake_minimum_required(VERSION 2.6) project (libdmg-hfsplus) ``` -------------------------------- ### Compile HFS+ Utilities Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/README.markdown Navigate to the hfs directory and run 'make' to compile the HFS+ utilities. Ensure you have a POSIX-compliant environment with GNU C. ```bash cd hfs make ``` -------------------------------- ### Compile hdutil Utility Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/README.markdown Navigate to the hdiutil directory and run 'make' to compile the hdutil utility, which supports reading directly from DMG files. ```bash cd hdiutil make ``` -------------------------------- ### Compile DMG Utilities with zlib Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/README.markdown Compile the DMG utilities by first configuring and making the included zlib, then compiling the main DMG components. This process requires a compatible C compiler and build tools. ```bash cd dmg/zlib-1.2.3 ./configure make cd .. make ``` -------------------------------- ### Create Executable 'dmg-bin' Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/dmg/CMakeLists.txt Builds an executable named 'dmg-bin' from 'dmg.c' and links it against the 'dmg' library. ```cmake add_executable(dmg-bin dmg.c) target_link_libraries (dmg-bin dmg) ``` -------------------------------- ### Create Symbolic Link Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Creates a symbolic link pointing to a target path on the HFS+ filesystem using makeSymlink. ```c #include #include int main() { io_func* io = openFlatFile("hfsplus.img"); Volume* volume = openVolume(io); // Create symlink: /usr/local/bin/app -> /Applications/MyApp.app/Contents/MacOS/app int result = makeSymlink("/usr/local/bin/app", "/Applications/MyApp.app/Contents/MacOS/app", volume); if (result == 0) { printf("Symlink created successfully\n"); } else { printf("Failed to create symlink\n"); } closeVolume(volume); CLOSE(io); return result; } ``` -------------------------------- ### Perform DMG Operations via Command Line Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Utility commands for extracting, building, and converting DMG files. ```bash # Extract DMG to raw image ./dmg extract image.dmg output.img # Extract specific partition (0-indexed) ./dmg extract image.dmg output.img 0 # Extract FileVault-encrypted DMG ./dmg extract encrypted.dmg output.img -k 0123456789ABCDEF0123456789ABCDEF # Build DMG from raw image ./dmg build filesystem.img new_image.dmg # Convert DMG to ISO ./dmg iso image.dmg image.iso # Convert ISO to DMG ./dmg dmg image.iso image.dmg ``` -------------------------------- ### Create Directory on HFS+ Volume Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Uses newFolder to create a directory at a specified path. Returns the CatalogNodeID on success or 0 on failure. ```c #include #include int main() { io_func* io = openFlatFile("hfsplus.img"); Volume* volume = openVolume(io); // Create a new directory HFSCatalogNodeID folderID = newFolder("/Documents/NewFolder", volume); if (folderID != 0) { printf("Directory created with ID: %u\n", folderID); } else { printf("Failed to create directory\n"); } closeVolume(volume); CLOSE(io); return (folderID != 0) ? 0 : 1; } ``` -------------------------------- ### Open FileVault Encrypted Images Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Wraps an AbstractFile with a FileVault decryption layer to access encrypted disk images. This requires OpenSSL/libcrypto. Provide the correct hex string for the decryption key. ```c #include #include int main() { // Open encrypted DMG AbstractFile* encrypted = createAbstractFileFromFile(fopen("encrypted.dmg", "rb")); if (!encrypted) { fprintf(stderr, "Cannot open encrypted DMG\n"); return 1; } // Wrap with FileVault decryption (key is hex string) const char* key = "0123456789ABCDEF0123456789ABCDEF"; AbstractFile* decrypted = createAbstractFileFromFileVault(encrypted, key); // Now use 'decrypted' as normal AbstractFile for reading // Extract the decrypted content AbstractFile* out = createAbstractFileFromFile(fopen("decrypted.img", "wb")); extractDmg(decrypted, out, -1); return 0; } ``` -------------------------------- ### Configure Static Library Build for Windows Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/CMakeLists.txt Sets the build to use static libraries by default on Windows systems. This is a common practice to simplify library management on Windows. ```cmake IF(WIN32) SET(BUILD_STATIC ON CACHE BOOL "Force compilation with static libraries") ELSE(WIN32) SET(BUILD_STATIC OFF CACHE BOOL "Force compilation with static libraries") ENDIF(WIN32) ``` -------------------------------- ### Create DMG from Raw Filesystem Image Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Builds a new DMG file from a raw HFS+ filesystem image. This function applies default compression settings and generates necessary metadata. Ensure input and output files are correctly opened. ```c #include #include int main() { // Open raw HFS+ image AbstractFile* in = createAbstractFileFromFile(fopen("filesystem.img", "rb")); if (!in) { fprintf(stderr, "Cannot open source image\n"); return 1; } // Create destination DMG file AbstractFile* out = createAbstractFileFromFile(fopen("new_image.dmg", "wb")); if (!out) { in->close(in); fprintf(stderr, "Cannot create DMG file\n"); return 1; } // Build DMG with default compression settings int result = buildDmg(in, out); return result ? 0 : 1; } ``` -------------------------------- ### Mount and Unmount HFS+ Volume Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Opens a raw HFS+ image file and mounts it as a volume. Ensure the volume is closed to flush changes to the underlying storage. ```c #include #include int main() { // Open raw HFS+ image file io_func* io = openFlatFile("hfsplus.img"); if (!io) { fprintf(stderr, "Cannot open image file\n"); return 1; } // Mount the HFS+ volume Volume* volume = openVolume(io); if (!volume) { fprintf(stderr, "Cannot open HFS+ volume\n"); CLOSE(io); return 1; } // Perform operations on volume... printf("Volume opened successfully\n"); printf("Block size: %u\n", volume->volumeHeader->blockSize); printf("Total blocks: %u\n", volume->volumeHeader->totalBlocks); printf("Free blocks: %u\n", volume->volumeHeader->freeBlocks); // Properly close volume and flush changes closeVolume(volume); CLOSE(io); return 0; } ``` -------------------------------- ### Create Static Library 'dmg' Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/dmg/CMakeLists.txt Compiles and links source files into a static library named 'dmg'. This library contains the core functionality of the project. ```cmake add_library(dmg adc.c base64.c checksum.c dmgfile.c dmglib.c filevault.c io.c partition.c resources.c udif.c) ``` -------------------------------- ### List Directory Contents Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Prints the contents of a specified directory to stdout using hfs_ls. ```c #include #include int main() { io_func* io = openFlatFile("hfsplus.img"); Volume* volume = openVolume(io); // List root directory printf("Contents of /:\n"); hfs_ls(volume, "/"); // List specific directory printf("\nContents of /Applications:\n"); hfs_ls(volume, "/Applications"); closeVolume(volume); CLOSE(io); return 0; } ``` -------------------------------- ### Manipulate HFS+ Filesystems via Command Line Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Utility commands for managing files, directories, and filesystem properties within an HFS+ image. ```bash # List directory contents ./hfs filesystem.img ls / ./hfs filesystem.img ls /Applications # Display file contents ./hfs filesystem.img cat /etc/hosts # Extract file from volume ./hfs filesystem.img extract /Documents/file.txt ./local_file.txt # Extract all files from directory ./hfs filesystem.img extractall /Documents ./extracted/ # Add file to volume ./hfs filesystem.img add ./local_file.txt /Documents/new_file.txt # Add entire directory tree ./hfs filesystem.img addall ./local_folder/ /ImportedData # Create directory ./hfs filesystem.img mkdir /NewFolder # Remove file ./hfs filesystem.img rm /Documents/obsolete.txt # Remove all files in directory ./hfs filesystem.img rmall /TempFiles # Move/rename file ./hfs filesystem.img mv /old_path/file.txt /new_path/file.txt # Create symbolic link ./hfs filesystem.img symlink /usr/bin/app /Applications/App.app/Contents/MacOS/app # Change file permissions ./hfs filesystem.img chmod 755 /Applications/MyApp # Grow filesystem ./hfs filesystem.img grow 2147483648 # Get extended attribute ./hfs filesystem.img getattr /file.txt com.apple.FinderInfo # Debug B-tree structure ./hfs filesystem.img debug ./hfs filesystem.img debug verbose ``` -------------------------------- ### Manage Extended Attributes in C Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Demonstrates reading, setting, and removing extended attributes on HFS+ files using the library's C API. ```c #include #include int main() { io_func* io = openFlatFile("hfsplus.img"); Volume* volume = openVolume(io); // Get file record to obtain fileID HFSPlusCatalogRecord* record = getRecordFromPath("/Documents/myfile.txt", volume, NULL, NULL); if (!record || record->recordType != kHFSPlusFileRecord) { fprintf(stderr, "File not found\n"); closeVolume(volume); CLOSE(io); return 1; } HFSCatalogNodeID fileID = ((HFSPlusCatalogFile*)record)->fileID; // Get extended attribute uint8_t* data = NULL; size_t size = getAttribute(volume, fileID, "com.apple.FinderInfo", &data); if (size > 0) { printf("Attribute size: %zu bytes\n", size); free(data); } // Set extended attribute uint8_t newData[] = {0x00, 0x01, 0x02, 0x03}; int result = setAttribute(volume, fileID, "com.example.custom", newData, sizeof(newData)); // Remove extended attribute result = unsetAttribute(volume, fileID, "com.example.custom"); free(record); closeVolume(volume); CLOSE(io); return 0; } ``` -------------------------------- ### Find Dependencies (OpenSSL, ZLIB) Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/dmg/CMakeLists.txt Includes CMake modules to find OpenSSL and ZLIB libraries. Ensures ZLIB is present, otherwise aborts the build. ```cmake INCLUDE(FindOpenSSL) INCLUDE(FindZLIB) ``` ```cmake IF(NOT ZLIB_FOUND) message(FATAL_ERROR "zlib is required for dmg!") ENDIF(NOT ZLIB_FOUND) ``` ```cmake include_directories(${ZLIB_INCLUDE_DIR}) link_directories(${ZLIB_LIBRARIES}) ``` -------------------------------- ### Convert ISO to DMG Format Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Converts a standard ISO image to Apple's DMG format. Ensure both input ISO and output DMG files are opened successfully before calling this function. ```c #include #include int main() { AbstractFile* in = createAbstractFileFromFile(fopen("image.iso", "rb")); AbstractFile* out = createAbstractFileFromFile(fopen("image.dmg", "wb")); if (!in || !out) { fprintf(stderr, "Cannot open files\n"); return 1; } // Convert ISO to DMG int result = convertToDMG(in, out); return result ? 0 : 1; } ``` -------------------------------- ### Add Subdirectories for Project Modules Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/CMakeLists.txt Includes the build configurations for various subdirectories within the project. Each subdirectory likely contains source code for a specific module. ```cmake add_subdirectory (common) add_subdirectory (dmg) add_subdirectory (hdutil) add_subdirectory (hfs) ``` -------------------------------- ### Convert DMG to ISO Format Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Converts a DMG disk image to standard ISO format for better cross-platform compatibility. Ensure both input DMG and output ISO files are opened successfully before calling. ```c #include #include int main() { AbstractFile* in = createAbstractFileFromFile(fopen("image.dmg", "rb")); AbstractFile* out = createAbstractFileFromFile(fopen("image.iso", "wb")); if (!in || !out) { fprintf(stderr, "Cannot open files\n"); return 1; } // Convert DMG to ISO int result = convertToISO(in, out); return result ? 0 : 1; } ``` -------------------------------- ### Lookup File or Directory by Path Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Retrieves a catalog record for a specific path. The returned record must be freed by the caller if it is not NULL. ```c #include #include int main() { io_func* io = openFlatFile("hfsplus.img"); Volume* volume = openVolume(io); // Look up a file by path char* name = NULL; HFSPlusCatalogKey key; HFSPlusCatalogRecord* record = getRecordFromPath("/Applications/Safari.app", volume, &name, &key); if (record != NULL) { if (record->recordType == kHFSPlusFileRecord) { HFSPlusCatalogFile* file = (HFSPlusCatalogFile*)record; printf("File ID: %u\n", file->fileID); printf("Data fork size: %llu bytes\n", file->dataFork.logicalSize); printf("Resource fork size: %llu bytes\n", file->resourceFork.logicalSize); } else if (record->recordType == kHFSPlusFolderRecord) { HFSPlusCatalogFolder* folder = (HFSPlusCatalogFolder*)record; printf("Folder ID: %u\n", folder->folderID); printf("Items in folder: %u\n", folder->valence); } free(record); } else { printf("Path not found\n"); } closeVolume(volume); CLOSE(io); return 0; } ``` -------------------------------- ### Add File to HFS+ Volume Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Imports a local file into the HFS+ filesystem at a specified destination path. ```c #include #include int main() { io_func* io = openFlatFile("hfsplus.img"); Volume* volume = openVolume(io); // Open local file to add AbstractFile* inFile = createAbstractFileFromFile(fopen("local_file.txt", "rb")); if (!inFile) { fprintf(stderr, "Cannot open source file\n"); closeVolume(volume); CLOSE(io); return 1; } // Add file to volume at specified path int result = add_hfs(volume, inFile, "/Documents/imported_file.txt"); if (result == 0) { printf("File added successfully\n"); } else { printf("Failed to add file\n"); } closeVolume(volume); CLOSE(io); return result; } ``` -------------------------------- ### Define HFS Static Library Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/hfs/CMakeLists.txt This snippet defines the 'hfs' static library, compiling all specified source files. It also links against the 'common' and 'z' libraries. ```cmake link_directories (${PROJECT_BINARY_DIR}/common) add_library(hfs btree.c catalog.c extents.c xattr.c fastunicodecompare.c flatfile.c hfslib.c rawfile.c utility.c volume.c hfscompress.c) target_link_libraries(hfs common z) ``` -------------------------------- ### Find ZLIB Dependency Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/hfs/CMakeLists.txt This snippet finds the zlib library, which is a required dependency for building hfs. If zlib is not found, the build will fail. ```cmake INCLUDE(FindZLIB) IF(NOT ZLIB_FOUND) message(FATAL_ERROR "zlib is required for hfs!") ENDIF(NOT ZLIB_FOUND) include_directories(${ZLIB_INCLUDE_DIR}) link_directories(${ZLIB_LIBRARIES}) ``` -------------------------------- ### Manage DMG Contents with hdutil Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Utility commands for direct manipulation of DMG files, including extraction and modification. ```bash # List contents of DMG file ./hdutil image.dmg ls / # Extract file from DMG ./hdutil image.dmg extract /Documents/file.txt ./output.txt # Work with encrypted DMG ./hdutil encrypted.dmg -k 0123456789ABCDEF ls / # Extract tar archive into DMG ./hdutil image.dmg untar archive.tar # Add files to DMG ./hdutil image.dmg add ./local_file.txt /destination/file.txt ./hdutil image.dmg addall ./folder/ /DestFolder # Modify DMG contents ./hdutil image.dmg mkdir /NewDirectory ./hdutil image.dmg rm /OldFile.txt ./hdutil image.dmg mv /Source/file.txt /Dest/file.txt ``` -------------------------------- ### Include Project Header Directory Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/CMakeLists.txt Adds the project's include directory to the search path for header files. This allows source files to include headers from the 'includes' subdirectory. ```cmake include_directories (${PROJECT_SOURCE_DIR}/includes) ``` -------------------------------- ### Change File Permissions and Ownership Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Modifies file attributes using chmodFile for permissions and chownFile for UID/GID ownership. ```c #include #include int main() { io_func* io = openFlatFile("hfsplus.img"); Volume* volume = openVolume(io); // Change file permissions (octal mode like chmod) int result = chmodFile("/Applications/myapp", 0755, volume); // rwxr-xr-x // Change file ownership uint32_t owner = 501; // UID uint32_t group = 20; // GID result = chownFile("/Applications/myapp", owner, group, volume); if (result == 0) { printf("Permissions/ownership changed\n"); } closeVolume(volume); CLOSE(io); return result; } ``` -------------------------------- ### Expand HFS+ Volume Size Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Resizes the HFS+ volume to a new byte size using grow_hfs. ```c #include #include int main() { io_func* io = openFlatFile("hfsplus.img"); Volume* volume = openVolume(io); // Grow volume to 2GB uint64_t newSize = 2ULL * 1024 * 1024 * 1024; // 2GB in bytes grow_hfs(volume, newSize); printf("Volume grown to %llu bytes\n", newSize); printf("New free blocks: %u\n", volume->volumeHeader->freeBlocks); closeVolume(volume); CLOSE(io); return 0; } ``` -------------------------------- ### Link Core Libraries Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/dmg/CMakeLists.txt Links the 'dmg' library with other necessary project libraries like 'common', 'hfs', and 'z'. ```cmake target_link_libraries(dmg common hfs z) ``` -------------------------------- ### Conditional OpenSSL Integration Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/dmg/CMakeLists.txt Adds OpenSSL support if found. Defines HAVE_CRYPT, includes OpenSSL headers, and links the crypto library. Includes GDI32 on Windows. ```cmake IF(OPENSSL_FOUND) add_definitions(-DHAVE_CRYPT) include_directories(${OPENSSL_INCLUDE_DIR}) target_link_libraries(dmg ${CRYPTO_LIBRARIES}) IF(WIN32) TARGET_LINK_LIBRARIES(dmg gdi32) ENDIF(WIN32) ENDIF(OPENSSL_FOUND) ``` -------------------------------- ### Move or Rename File/Directory Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Uses the move function to relocate or rename files and directories within the HFS+ volume. ```c #include #include int main() { io_func* io = openFlatFile("hfsplus.img"); Volume* volume = openVolume(io); // Rename a file int result = move("/Documents/old_name.txt", "/Documents/new_name.txt", volume); // Move a file to different directory result = move("/Documents/file.txt", "/Archive/file.txt", volume); if (result == 0) { printf("Move/rename successful\n"); } else { printf("Move/rename failed\n"); } closeVolume(volume); CLOSE(io); return result; } ``` -------------------------------- ### Link Project Directories Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/dmg/CMakeLists.txt Specifies directories for linking libraries within the project. This is typically used for internal project dependencies. ```cmake link_directories(${PROJECT_BINARY_DIR}/common ${PROJECT_BINARY_DIR}/hfs) ``` -------------------------------- ### Extract File from HFS+ Volume Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Extracts file contents to a local file using either the helper function or manual record lookup. ```c #include #include int main() { io_func* io = openFlatFile("hfsplus.img"); Volume* volume = openVolume(io); // Create output file AbstractFile* outFile = createAbstractFileFromFile(fopen("extracted_file.txt", "wb")); if (!outFile) { fprintf(stderr, "Cannot create output file\n"); closeVolume(volume); CLOSE(io); return 1; } // Method 1: Using get_hfs helper get_hfs(volume, "/Documents/myfile.txt", outFile); // Method 2: Using getRecordFromPath + writeToFile HFSPlusCatalogRecord* record = getRecordFromPath("/Documents/myfile.txt", volume, NULL, NULL); if (record && record->recordType == kHFSPlusFileRecord) { writeToFile((HFSPlusCatalogFile*)record, outFile, volume); free(record); } outFile->close(outFile); closeVolume(volume); CLOSE(io); return 0; } ``` -------------------------------- ### Extract Raw Data from DMG Image Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Use this function to extract raw filesystem data from a DMG file. It handles decompression and decryption, and supports partition selection. Ensure input and output files are correctly opened. ```c #include #include int main() { // Open source DMG file AbstractFile* in = createAbstractFileFromFile(fopen("image.dmg", "rb")); if (!in) { fprintf(stderr, "Cannot open DMG file\n"); return 1; } // Create output file for extracted data AbstractFile* out = createAbstractFileFromFile(fopen("output.img", "wb")); if (!out) { in->close(in); fprintf(stderr, "Cannot create output file\n"); return 1; } // Extract partition -1 (auto-detect HFS+ partition) int partNum = -1; int result = extractDmg(in, out, partNum); // Files are closed automatically by extractDmg return result ? 0 : 1; } ``` -------------------------------- ### Set Output Name Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/dmg/CMakeLists.txt Sets the output name of the 'dmg-bin' executable to 'dmg'. This ensures the final binary is named 'dmg'. ```cmake set_target_properties(dmg-bin PROPERTIES OUTPUT_NAME "dmg") ``` -------------------------------- ### Extract Tar Archive to HFS+ Volume Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Extracts a tar archive into the HFS+ filesystem using hfs_untar. Requires an AbstractFile handle for the source archive. ```c #include #include int main() { io_func* io = openFlatFile("hfsplus.img"); Volume* volume = openVolume(io); // Open tar file AbstractFile* tarFile = createAbstractFileFromFile(fopen("archive.tar", "rb")); if (!tarFile) { fprintf(stderr, "Cannot open tar file\n"); closeVolume(volume); CLOSE(io); return 1; } // Extract tar to root of volume hfs_untar(volume, tarFile); tarFile->close(tarFile); closeVolume(volume); CLOSE(io); printf("Archive extracted successfully\n"); return 0; } ``` -------------------------------- ### Delete File from HFS+ Volume Source: https://context7.com/planetbeing/libdmg-hfsplus/llms.txt Removes a file or empty directory from the filesystem. Returns 0 on success. ```c #include #include int main() { io_func* io = openFlatFile("hfsplus.img"); Volume* volume = openVolume(io); // Remove a file int result = removeFile("/Documents/obsolete_file.txt", volume); if (result == 0) { printf("File removed successfully\n"); } else { printf("Failed to remove file (may not exist or is a non-empty directory)\n"); } closeVolume(volume); CLOSE(io); return result; } ``` -------------------------------- ### Set Library Suffix for Static Builds Source: https://github.com/planetbeing/libdmg-hfsplus/blob/master/CMakeLists.txt Appends the '.a' suffix to library names when static compilation is enabled. This ensures CMake correctly identifies static libraries. ```cmake IF(BUILD_STATIC) SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") ENDIF(BUILD_STATIC) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.