mirror of
https://github.com/etlegacy/Update-Installer.git
synced 2024-11-10 06:31:49 +00:00
Fix zip-tool build on Mac
Add the Security and Cocoa frameworks as link dependencies of the shared updater library. MD-19678 #time 10m
This commit is contained in:
parent
2658f1235d
commit
b168ed69d7
3 changed files with 11 additions and 12 deletions
|
@ -106,6 +106,12 @@ target_link_libraries(updatershared
|
||||||
tinythread
|
tinythread
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
find_library(COCOA_LIBRARY Cocoa)
|
||||||
|
find_library(SECURITY_LIBRARY Security)
|
||||||
|
target_link_libraries(updatershared ${SECURITY_LIBRARY} ${COCOA_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
target_link_libraries(updatershared pthread dl)
|
target_link_libraries(updatershared pthread dl)
|
||||||
endif()
|
endif()
|
||||||
|
@ -116,13 +122,6 @@ endif()
|
||||||
|
|
||||||
add_executable(updater ${EXE_FLAGS} main.cpp)
|
add_executable(updater ${EXE_FLAGS} main.cpp)
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
set_target_properties(
|
|
||||||
updater
|
|
||||||
PROPERTIES LINK_FLAGS "-framework Security -framework Cocoa"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(updater
|
target_link_libraries(updater
|
||||||
updatershared
|
updatershared
|
||||||
)
|
)
|
||||||
|
@ -133,7 +132,7 @@ endif()
|
||||||
|
|
||||||
install(TARGETS updater RUNTIME DESTINATION bin)
|
install(TARGETS updater RUNTIME DESTINATION bin)
|
||||||
|
|
||||||
add_executable(zip-tool zip.cpp)
|
add_executable(zip-tool zip-tool.cpp)
|
||||||
target_link_libraries(zip-tool updatershared)
|
target_link_libraries(zip-tool updatershared)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ void FileUtils::addToZip(const char* archivePath, const char* path, const char*
|
||||||
{
|
{
|
||||||
throw IOException("Unable to add new file to zip archive");
|
throw IOException("Unable to add new file to zip archive");
|
||||||
}
|
}
|
||||||
result = zipWriteInFileInZip(archive, content, length);
|
result = zipWriteInFileInZip(archive, content, static_cast<unsigned int>(length));
|
||||||
if (result != ZIP_OK)
|
if (result != ZIP_OK)
|
||||||
{
|
{
|
||||||
throw IOException("Unable to write file data to zip archive");
|
throw IOException("Unable to write file data to zip archive");
|
||||||
|
@ -536,14 +536,14 @@ void FileUtils::writeFile(const char* path, const char* data, int length) throw
|
||||||
stream.write(data,length);
|
stream.write(data,length);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FileUtils::readFile(const char* path)
|
std::string FileUtils::readFile(const char* path) throw (IOException)
|
||||||
{
|
{
|
||||||
std::ifstream inputFile(path, std::ios::in | std::ios::binary);
|
std::ifstream inputFile(path, std::ios::in | std::ios::binary);
|
||||||
std::string content;
|
std::string content;
|
||||||
inputFile.seekg(0, std::ios::end);
|
inputFile.seekg(0, std::ios::end);
|
||||||
content.resize(static_cast<unsigned int>(inputFile.tellg()));
|
content.resize(static_cast<unsigned int>(inputFile.tellg()));
|
||||||
inputFile.seekg(0, std::ios::beg);
|
inputFile.seekg(0, std::ios::beg);
|
||||||
inputFile.read(&content[0], content.size());
|
inputFile.read(&content[0], static_cast<int>(content.size()));
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ int main(int argc, char** argv)
|
||||||
std::string path = iter->substr(inputDir.size()+1);
|
std::string path = iter->substr(inputDir.size()+1);
|
||||||
std::string content = FileUtils::readFile(iter->c_str());
|
std::string content = FileUtils::readFile(iter->c_str());
|
||||||
LOG(Info, "Adding " + path + " to archive " + archivePath);
|
LOG(Info, "Adding " + path + " to archive " + archivePath);
|
||||||
FileUtils::addToZip(archivePath.c_str(), path.c_str(), content.data(), content.length());
|
FileUtils::addToZip(archivePath.c_str(), path.c_str(), content.data(), static_cast<int>(content.length()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const std::exception& ex)
|
catch (const std::exception& ex)
|
Loading…
Reference in a new issue