Merge pull request #738 from ctrlaltca/zip_win32
Fix zip support in oracle under win32; fix #736
This commit is contained in:
commit
e4147e6476
3 changed files with 17 additions and 6 deletions
|
@ -11,8 +11,6 @@ SET(oracle_SOURCES
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/oraclewizard.cpp
|
src/oraclewizard.cpp
|
||||||
src/oracleimporter.cpp
|
src/oracleimporter.cpp
|
||||||
src/zip/unzip.cpp
|
|
||||||
src/zip/zipglobal.cpp
|
|
||||||
../cockatrice/src/carddatabase.cpp
|
../cockatrice/src/carddatabase.cpp
|
||||||
../cockatrice/src/settingscache.cpp
|
../cockatrice/src/settingscache.cpp
|
||||||
../cockatrice/src/qt-json/json.cpp
|
../cockatrice/src/qt-json/json.cpp
|
||||||
|
@ -123,6 +121,12 @@ FIND_PACKAGE(ZLIB)
|
||||||
IF(ZLIB_FOUND)
|
IF(ZLIB_FOUND)
|
||||||
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
|
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
|
||||||
ADD_DEFINITIONS("-DHAS_ZLIB")
|
ADD_DEFINITIONS("-DHAS_ZLIB")
|
||||||
|
|
||||||
|
set(oracle_SOURCES ${oracle_SOURCES}
|
||||||
|
src/zip/unzip.cpp
|
||||||
|
src/zip/zipglobal.cpp
|
||||||
|
)
|
||||||
|
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE(STATUS "Oracle: zlib not found; ZIP support disabled")
|
MESSAGE(STATUS "Oracle: zlib not found; ZIP support disabled")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@ -205,6 +209,12 @@ IF(WIN32)
|
||||||
# these needs to be relative to CMAKE_INSTALL_PREFIX
|
# these needs to be relative to CMAKE_INSTALL_PREFIX
|
||||||
set(plugin_dest_dir Plugins)
|
set(plugin_dest_dir Plugins)
|
||||||
set(qtconf_dest_dir .)
|
set(qtconf_dest_dir .)
|
||||||
|
list(APPEND libSearchDirs ${QT_LIBRARY_DIR})
|
||||||
|
IF(ZLIB_FOUND)
|
||||||
|
get_filename_component(ZLIB_DLL_DIR "${ZLIB_INCLUDE_DIRS}/../bin/" REALPATH)
|
||||||
|
list(APPEND libSearchDirs ${ZLIB_DLL_DIR})
|
||||||
|
ENDIF()
|
||||||
|
MESSAGE(STATUS "Oracle: ZLIB dll found at ${ZLIB_DLL_DIR}")
|
||||||
|
|
||||||
# qt4: codecs, iconengines, imageformats
|
# qt4: codecs, iconengines, imageformats
|
||||||
# qt5: iconengines, imageformats, platforms
|
# qt5: iconengines, imageformats, platforms
|
||||||
|
@ -223,6 +233,6 @@ Translations = Resources/translations\")
|
||||||
\"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dll\")
|
\"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dll\")
|
||||||
set(BU_CHMOD_BUNDLE_ITEMS ON)
|
set(BU_CHMOD_BUNDLE_ITEMS ON)
|
||||||
include(BundleUtilities)
|
include(BundleUtilities)
|
||||||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/oracle.exe\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\")
|
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/oracle.exe\" \"\${QTPLUGINS}\" \"${libSearchDirs}\")
|
||||||
" COMPONENT Runtime)
|
" COMPONENT Runtime)
|
||||||
endif()
|
endif()
|
|
@ -29,11 +29,12 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "settingscache.h"
|
#include "settingscache.h"
|
||||||
|
|
||||||
|
#define ZIP_SIGNATURE "PK"
|
||||||
|
#define ALLSETS_URL_FALLBACK "http://mtgjson.com/json/AllSets.json"
|
||||||
|
|
||||||
#ifdef HAS_ZLIB
|
#ifdef HAS_ZLIB
|
||||||
#include "zip/unzip.h"
|
#include "zip/unzip.h"
|
||||||
#define ZIP_SIGNATURE "PK"
|
|
||||||
#define ALLSETS_URL "http://mtgjson.com/json/AllSets.json.zip"
|
#define ALLSETS_URL "http://mtgjson.com/json/AllSets.json.zip"
|
||||||
#define ALLSETS_URL_FALLBACK "http://mtgjson.com/json/AllSets.json"
|
|
||||||
#else
|
#else
|
||||||
#define ALLSETS_URL "http://mtgjson.com/json/AllSets.json"
|
#define ALLSETS_URL "http://mtgjson.com/json/AllSets.json"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -115,7 +115,7 @@ bool OSDAB_ZIP_MANGLE(setFileTimestamp)(const QString& fileName, const QDateTime
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
HANDLE hFile = CreateFile(fileName.toStdWString().c_str(),
|
HANDLE hFile = CreateFileW(fileName.toStdWString().c_str(),
|
||||||
GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
|
GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
|
||||||
if (hFile == INVALID_HANDLE_VALUE) {
|
if (hFile == INVALID_HANDLE_VALUE) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue