From a2067af4ea7c3ce33f746717eda9b84a6a832d31 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 23 Jun 2010 12:44:23 +0000 Subject: [PATCH] Use putenv on Windows too --- src/bittorrent.cpp | 8 -------- src/main.cpp | 10 +++------- src/searchengine.cpp | 4 ---- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 199a9f035..3de95ba46 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -1862,12 +1862,8 @@ void Bittorrent::addConsoleMessage(QString msg, QString) { default: qDebug("Disabling HTTP communications proxy"); #ifdef Q_WS_WIN -#ifdef MINGW putenv("http_proxy="); putenv("sock_proxy="); -#else - SetEnvironmentVariableA("http_proxy", ""); - SetEnvironmentVariableA("sock_proxy", ""); #endif #else unsetenv("http_proxy"); @@ -1882,12 +1878,8 @@ void Bittorrent::addConsoleMessage(QString msg, QString) { type_str = "sock_proxy"; else type_str = "http_proxy"; -#ifdef MINGW QString tmp = type_str+"="+proxy_str; putenv(tmp.toLocal8Bit().constData()); -#else - SetEnvironmentVariableA(type_str.toLocal8Bit().constData(), proxy_str.toLocal8Bit().constData()); -#endif #else qDebug("HTTP communications proxy string: %s", qPrintable(proxy_str)); if(proxySettings.type == proxy_settings::socks5 || proxySettings.type == proxy_settings::socks5_pw) diff --git a/src/main.cpp b/src/main.cpp index 3b794ad04..bbcd668f8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -271,13 +271,9 @@ int main(int argc, char *argv[]){ } #endif // Set environment variable -#if defined(Q_WS_WIN) && !defined(MINGW) - if(SetEnvironmentVariableA("QBITTORRENT", VERSION)) { -#else - if(putenv((char*)"QBITTORRENT="VERSION)) { -#endif - std::cerr << "Couldn't set environment variable...\n"; - } + if(putenv((char*)"QBITTORRENT="VERSION)) { + std::cerr << "Couldn't set environment variable...\n"; + } #ifndef DISABLE_GUI useStyle(app, settings.value("Preferences/General/Style", "").toString()); diff --git a/src/searchengine.cpp b/src/searchengine.cpp index ee726f5fd..58b697daf 100644 --- a/src/searchengine.cpp +++ b/src/searchengine.cpp @@ -120,12 +120,8 @@ bool SearchEngine::addPythonPathToEnv() { } path_envar = python_path+";"+path_envar; qDebug("New PATH envvar is: %s", qPrintable(path_envar)); -#ifdef MINGW QString envar = "PATH="+path_envar; putenv(envar.toLocal8Bit().data()); -#else - SetEnvironmentVariableA("PATH", path_envar.toLocal8Bit().constData()); -#endif return true; } return false;