void extractLauncherResource()

in src/main/cpp/launcher/windows/src/ExtractUtils.c [606:639]


void extractLauncherResource(LauncherProperties * props, LauncherResource ** file, char * name) {
    char * typeStr = appendString(appendString(NULL, name), " type");
    * file = newLauncherResource();
    
    readNumberWithDebug( props, & ((*file)->type) , typeStr);
    
    if(isOK(props)) {
        FREE(typeStr);
        
        if((*file)->type==0) { //bundled
            writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1,  "... file is bundled", 1);
            extractFileToDir(props, & ((*file)->path));
            if(!isOK(props)) {
                writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1,  "Error extracting file!", 1);
                return;
            } else {
                (*file)->resolved = appendStringW(NULL, (*file)->path);
                writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "file was succesfully extracted to ", 0);
                writeMessageW(props, OUTPUT_LEVEL_DEBUG, 0,  (*file)->path, 1);
            }
        } else {
            writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1,  "... file is external", 1);
            readStringWithDebugW(props, & ((*file)->path), name);
            if(!isOK(props)) {
                writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1, "Error reading ", 1);
                writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1, name, 1);
            }
        }
    }  else {
        writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1, "Error reading ", 0);
        writeMessageA(props, OUTPUT_LEVEL_DEBUG, 1, typeStr, 0);
        FREE(typeStr);
    }
}