mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 23:17:21 -06:00
Fix Geoip database embedding
Fix Geoip path issue on Win32
This commit is contained in:
10
src/geoip.h
10
src/geoip.h
@@ -68,13 +68,19 @@ protected:
|
||||
// Create geoip folder is necessary
|
||||
QDir gfolder(geoipFolder(false));
|
||||
if(!gfolder.exists()) {
|
||||
if(!gfolder.mkpath(geoipFolder(false))) return;
|
||||
if(!gfolder.mkpath(geoipFolder(false))) {
|
||||
std::cerr << "Failed to create geoip folder at " << qPrintable(geoipFolder(false)) << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Remove destination files
|
||||
if(QFile::exists(geoipDBpath(false)))
|
||||
QFile::remove(geoipDBpath(false));
|
||||
// Copy from executable to hard disk
|
||||
QFile::copy(geoipDBpath(true), geoipDBpath(false));
|
||||
qDebug("%s -> %s", qPrintable(geoipDBpath(true)), qPrintable(geoipDBpath(false)));
|
||||
if(!QFile::copy(geoipDBpath(true), geoipDBpath(false))) {
|
||||
std::cerr << "ERROR: Failed to copy geoip.dat from executable to hard disk" << std::endl;
|
||||
}
|
||||
qDebug("Local Geoip database was updated");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
<file>geoip/GeoIP.dat</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file>geoip/GeoIP.dat</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -74,6 +74,8 @@ QString misc::QDesktopServicesDataLocation() {
|
||||
result = QString::fromWCharArray(path);
|
||||
if (!QCoreApplication::applicationName().isEmpty())
|
||||
result = result + QLatin1String("\\") + qApp->applicationName();
|
||||
if(!result.endsWith("\\"))
|
||||
result += "\\";
|
||||
return result;
|
||||
#else
|
||||
#ifdef Q_WS_MAC
|
||||
|
||||
14
src/src.pro
14
src/src.pro
@@ -3,7 +3,7 @@ LANG_PATH = lang
|
||||
ICONS_PATH = Icons
|
||||
|
||||
# Set the following variable to 1 to enable debug
|
||||
DEBUG_MODE = 0
|
||||
DEBUG_MODE = 1
|
||||
|
||||
# Global
|
||||
TEMPLATE = app
|
||||
@@ -177,6 +177,12 @@ os2:LIBS += -ltorrent-rasterbar \
|
||||
}
|
||||
unix:!macx:contains(DEFINES, WITH_GEOIP_EMBEDDED):message("You chose to embed GeoIP database in qBittorrent executable.")
|
||||
|
||||
# Resource files
|
||||
RESOURCES = icons.qrc \
|
||||
lang.qrc \
|
||||
search.qrc \
|
||||
webui.qrc
|
||||
|
||||
# Add GeoIP resource file if the GeoIP database
|
||||
# should be embedded in qBittorrent executable
|
||||
contains(DEFINES, WITH_GEOIP_EMBEDDED) {
|
||||
@@ -192,12 +198,6 @@ os2:LIBS += -ltorrent-rasterbar \
|
||||
else:message("GeoIP database will not be embedded in qBittorrent executable.")
|
||||
}
|
||||
|
||||
# Resource files
|
||||
RESOURCES = icons.qrc \
|
||||
lang.qrc \
|
||||
search.qrc \
|
||||
webui.qrc
|
||||
|
||||
# Translations
|
||||
TRANSLATIONS = $$LANG_PATH/qbittorrent_fr.ts \
|
||||
$$LANG_PATH/qbittorrent_zh.ts \
|
||||
|
||||
Reference in New Issue
Block a user