mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Use putenv on Windows too
This commit is contained in:
parent
2f4f06ca8b
commit
a2067af4ea
@ -1862,12 +1862,8 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
|||||||
default:
|
default:
|
||||||
qDebug("Disabling HTTP communications proxy");
|
qDebug("Disabling HTTP communications proxy");
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
#ifdef MINGW
|
|
||||||
putenv("http_proxy=");
|
putenv("http_proxy=");
|
||||||
putenv("sock_proxy=");
|
putenv("sock_proxy=");
|
||||||
#else
|
|
||||||
SetEnvironmentVariableA("http_proxy", "");
|
|
||||||
SetEnvironmentVariableA("sock_proxy", "");
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
unsetenv("http_proxy");
|
unsetenv("http_proxy");
|
||||||
@ -1882,12 +1878,8 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
|||||||
type_str = "sock_proxy";
|
type_str = "sock_proxy";
|
||||||
else
|
else
|
||||||
type_str = "http_proxy";
|
type_str = "http_proxy";
|
||||||
#ifdef MINGW
|
|
||||||
QString tmp = type_str+"="+proxy_str;
|
QString tmp = type_str+"="+proxy_str;
|
||||||
putenv(tmp.toLocal8Bit().constData());
|
putenv(tmp.toLocal8Bit().constData());
|
||||||
#else
|
|
||||||
SetEnvironmentVariableA(type_str.toLocal8Bit().constData(), proxy_str.toLocal8Bit().constData());
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
qDebug("HTTP communications proxy string: %s", qPrintable(proxy_str));
|
qDebug("HTTP communications proxy string: %s", qPrintable(proxy_str));
|
||||||
if(proxySettings.type == proxy_settings::socks5 || proxySettings.type == proxy_settings::socks5_pw)
|
if(proxySettings.type == proxy_settings::socks5 || proxySettings.type == proxy_settings::socks5_pw)
|
||||||
|
10
src/main.cpp
10
src/main.cpp
@ -271,13 +271,9 @@ int main(int argc, char *argv[]){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// Set environment variable
|
// Set environment variable
|
||||||
#if defined(Q_WS_WIN) && !defined(MINGW)
|
if(putenv((char*)"QBITTORRENT="VERSION)) {
|
||||||
if(SetEnvironmentVariableA("QBITTORRENT", VERSION)) {
|
std::cerr << "Couldn't set environment variable...\n";
|
||||||
#else
|
}
|
||||||
if(putenv((char*)"QBITTORRENT="VERSION)) {
|
|
||||||
#endif
|
|
||||||
std::cerr << "Couldn't set environment variable...\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
useStyle(app, settings.value("Preferences/General/Style", "").toString());
|
useStyle(app, settings.value("Preferences/General/Style", "").toString());
|
||||||
|
@ -120,12 +120,8 @@ bool SearchEngine::addPythonPathToEnv() {
|
|||||||
}
|
}
|
||||||
path_envar = python_path+";"+path_envar;
|
path_envar = python_path+";"+path_envar;
|
||||||
qDebug("New PATH envvar is: %s", qPrintable(path_envar));
|
qDebug("New PATH envvar is: %s", qPrintable(path_envar));
|
||||||
#ifdef MINGW
|
|
||||||
QString envar = "PATH="+path_envar;
|
QString envar = "PATH="+path_envar;
|
||||||
putenv(envar.toLocal8Bit().data());
|
putenv(envar.toLocal8Bit().data());
|
||||||
#else
|
|
||||||
SetEnvironmentVariableA("PATH", path_envar.toLocal8Bit().constData());
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user