From 3ed6f51fcce09c3a70613aa85d4c6e8fed861f2e Mon Sep 17 00:00:00 2001 From: ezequiel Date: Thu, 24 Mar 2016 15:56:54 -0300 Subject: [PATCH] corrige alguns bugs versao 4.0.0 --- Clipboard/Clipboard.py | 2 +- Clipboard/Clipboard.pyc | Bin 0 -> 1167 bytes Clipboard/test.py | 5 +++++ install/inno setup/user_install.bat | 132 ------------------------------------------------------------------------------------------------------------------------------------ install/inno setup/user_install.iss | 34 ++++++++++++++++++---------------- update/checkVersion.cpp | 133 ------------------------------------------------------------------------------------------------------------------------------------- update/include/pyVlibrasUpdate.h | 31 ------------------------------- update/src/configureEnvironmentVariables.cpp | 61 +++++++++++++++++++++++++++++++++---------------------------- update/src/pyVlibrasUpdate.cpp | 103 ------------------------------------------------------------------------------------------------------- 9 files changed, 57 insertions(+), 444 deletions(-) create mode 100644 Clipboard/Clipboard.pyc create mode 100644 Clipboard/test.py delete mode 100644 install/inno setup/user_install.bat delete mode 100644 update/checkVersion.cpp delete mode 100644 update/include/pyVlibrasUpdate.h delete mode 100644 update/src/pyVlibrasUpdate.cpp diff --git a/Clipboard/Clipboard.py b/Clipboard/Clipboard.py index cbc6376..b6d810b 100644 --- a/Clipboard/Clipboard.py +++ b/Clipboard/Clipboard.py @@ -26,7 +26,7 @@ def clip(): # Ativa bdrag def bdragOn(): global process - process = subprocess.Popen("bdrag") + process = subprocess.Popen("C:\\VLibras\\bin\\bdrag.exe") # Finaliza bdrag def bdragOff(): diff --git a/Clipboard/Clipboard.pyc b/Clipboard/Clipboard.pyc new file mode 100644 index 0000000..f997e60 Binary files /dev/null and b/Clipboard/Clipboard.pyc differ diff --git a/Clipboard/test.py b/Clipboard/test.py new file mode 100644 index 0000000..11148da --- /dev/null +++ b/Clipboard/test.py @@ -0,0 +1,5 @@ +from Clipboard import *; + +if __name__ == "__main__": + + print(clip()); \ No newline at end of file diff --git a/install/inno setup/user_install.bat b/install/inno setup/user_install.bat deleted file mode 100644 index a9f8033..0000000 --- a/install/inno setup/user_install.bat +++ /dev/null @@ -1,132 +0,0 @@ -::############################## Instalador VLibras ############################ -::# # -::# Bruno Santos # -::# brunosantos@lavid.ufpb.br -::# Ezequiel Silva # -::# ezequielsilva@lavid.ufpb.br # -::# # -::############################################################################## - -::Define Título da janela do prompt -TITLE Instalador VLibras Windows - -::Limpa a tela -CLS - -::Desabilita mensagens -@ECHO off - -ECHO ############### Instalando VLibras ############### - - - - -set PATH_VLIBRAS="%HOMEDRIVE%\VLibras" - - - -::################# Variáveis de Ambiente ################# -ECHO Exportando Variaveis de Ambiente: - -ECHO AELIUS_DATA -SETX AELIUS_DATA %PATH_VLIBRAS%\aelius_data /M - -ECHO NLTK_DATA -SETX NLTK_DATA %PATH_VLIBRAS%\nltk_data /M - -ECHO HUNPOS_TAGGER -SETX HUNPOS_TAGGER %PATH_VLIBRAS%\bin\hunpos-tag.exe /M - -ECHO TRANSLATE_DATA -SETX TRANSLATE_DATA %PATH_VLIBRAS%\translate\data /M - -ECHO PYTHONPATH -SETX PYTHONPATH %HOMEDRIVE%\Python27;%HOMEDRIVE%\Python27\Scripts;%HOMEDRIVE%\Python27\Lib\site-packages;%PATH_VLIBRAS%;%PATH_VLIBRAS%\bin;%PATH_VLIBRAS%\translate\src;%PATH_VLIBRAS%\Clipboard;%PATH_VLIBRAS%\update;%PATH_VLIBRAS%\nltk_data;%PATH_VLIBRAS%\Aelius /M - -@echo off -set path_value=%PATH% - -::ECHO PATH -::SETX PATH %PATH_VLIBRAS%\bin;%HOMEDRIVE%\Python27;%HOMEDRIVE%\Python27\Scripts;%HOMEDRIVE%\Python27\Lib\site-packages /M - - - - - -SET MYPATHCOPY=%PATH% -SET PATH_COPY= -SET ENCONTRADO="NO" - - -:search -for /f "delims=; tokens=1,2*" %%p in ("%MYPATHCOPY%") do ( - - ECHO.%%~p | FIND /I "ibras" >Nul && ( - Echo %%~p - ) || ( - - ECHO.%%~p | FIND /I "Python27" >Nul && ( - Echo %%~p - ) || ( - SET "PATH_COPY=%%~p;%PATH_COPY%" - ) - ) - - SET MYPATHCOPY=%%~q;%%~r -) - -if "%MYPATHCOPY%"==";" goto done; -goto search; - -:done - - -SETX "PATH" "%PATH_COPY%;%%PYTHONPATH%%" /M -SETX "PATH" "%PATH_COPY%;%%PYTHONPATH%%" - -echo %PATH% - -::################# Instalação do Python ################# -::msiexec /i python-2.7.9.msi /passive -::ECHO OK - -::################# Dependências ################# - - -c:\Python27\python.exe pip-6.0.8-py2.py3-none-any.whl/pip install pip-6.0.8-py2.py3-none-any.whl -ECHO OK - - -c:\Python27\Scripts\pip install PyYAML-3.11-cp27-none-win32.whl -ECHO OK - -c:\Python27\Scripts\pip install numpy-1.9.2+mkl-cp27-none-win32.whl -ECHO OK - -c:\Python27\Scripts\pip install six-1.9.0-py2.py3-none-any.whl -ECHO OK - -c:\Python27\Scripts\pip install pyparsing-2.0.3-py2-none-any.whl -ECHO OK - -c:\Python27\Scripts\pip install pytz-2014.10-py2.py3-none-any.whl -ECHO OK - -c:\Python27\Scripts\pip install python_dateutil-2.4.0-py2.py3-none-any.whl -ECHO OK - -c:\Python27\Scripts\pip install matplotlib-1.4.3-cp27-none-win32.whl -ECHO OK - -c:\Python27\Scripts\pip install nltk-3.0.2-py2.py3-none-any.whl -ECHO OK - -c:\Python27\Scripts\pip install future-0.14.3-py2-none-any.whl -ECHO OK - -::################# HUNPOS.PY & DATA.PY ############################# -COPY %PATH_VLIBRAS%\nltk_data\hunpos.py %homedrive%\Python27\Lib\site-packages\nltk\tag\ /y -COPY %PATH_VLIBRAS%\nltk_data\data.py %homedrive%\Python27\Lib\site-packages\nltk /y -COPY %PATH_VLIBRAS%\nltk_data\nltk_tgrep.py %homedrive%\Python27\Lib\site-packages /y - -ECHO VLibras Tradutor instalado com sucesso! diff --git a/install/inno setup/user_install.iss b/install/inno setup/user_install.iss index 9d652eb..b1e4e70 100644 --- a/install/inno setup/user_install.iss +++ b/install/inno setup/user_install.iss @@ -58,22 +58,23 @@ Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; Tasks: quicklaunchicon; IconFilename: "{app}\icons\icon_vlibras.ico" [Run] -Filename: {tmp}\configureEnvironmentVariables.exe ; Flags: runhidden; StatusMsg: Definindo variveis de ambiente... -Filename: msiexec ; Flags: runhidden; Parameters: /i {tmp}\python-2.7.9.msi /passive; StatusMsg: Instalando python-2.7.9... -Filename: {tmp}\required\user_install.bat; Flags: runhidden; StatusMsg: Instalando dependncias... - -Filename: python ; Flags: runhidden; Parameters: {tmp}\required\pip-6.0.8-py2.py3-none-any.whl/pip install {tmp}\required\pip-6.0.8-py2.py3-none-any.whl; StatusMsg: Instalando Pip... -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\PyYAML-3.11-cp27-none-win32.whl; StatusMsg: Instalando PyYAML... -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\numpy-1.9.2+mkl-cp27-none-win32.whl; StatusMsg: Instalando numpy... -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\six-1.9.0-py2.py3-none-any.whl; StatusMsg: Instalando six... -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\pyparsing-2.0.3-py2-none-any.whl; StatusMsg: Instalando pyparsing... -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\pytz-2014.10-py2.py3-none-any.whl; StatusMsg: Instalando pytz... -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\python_dateutil-2.4.0-py2.py3-none-any.whl; StatusMsg: Instalando python_dateutil... -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\matplotlib-1.4.3-cp27-none-win32.whl; StatusMsg: Instalando matplotlib... -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\nltk-3.0.2-py2.py3-none-any.whl; StatusMsg: Instalando nltk... -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\future-0.14.3-py2-none-any.whl; StatusMsg: Instalando future... +Filename: msiexec ; Flags: runhidden; Parameters: /i {tmp}\python-2.7.9.msi /passive; StatusMsg: Instalando dependncias... + +Filename: C:\Python27\python.exe ; Flags: runhidden; Parameters: {tmp}\required\pip-6.0.8-py2.py3-none-any.whl/pip install {tmp}\required\pip-6.0.8-py2.py3-none-any.whl; StatusMsg: Instalando dependncias... +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\PyYAML-3.11-cp27-none-win32.whl; StatusMsg: Instalando dependncias... +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\numpy-1.9.2+mkl-cp27-none-win32.whl; StatusMsg: Instalando dependncias... +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\six-1.9.0-py2.py3-none-any.whl; StatusMsg: Instalando dependncias... +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\pyparsing-2.0.3-py2-none-any.whl; StatusMsg: Instalando dependncias... +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\pytz-2014.10-py2.py3-none-any.whl; StatusMsg: Instalando dependncias... +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\python_dateutil-2.4.0-py2.py3-none-any.whl; StatusMsg: Instalando dependncias... +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\matplotlib-1.4.3-cp27-none-win32.whl; StatusMsg: Instalando dependncias... +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\nltk-3.0.2-py2.py3-none-any.whl; StatusMsg: Instalando dependncias... +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\future-0.14.3-py2-none-any.whl; StatusMsg: Instalando dependncias... +Filename: {tmp}\configureEnvironmentVariables.exe ; Flags: runhidden; StatusMsg: Definindo variveis de ambiente... +[UninstallDelete] +Type: filesandordirs; Name: "{app}" [Code] @@ -88,7 +89,7 @@ begin MyProgChecked:= True; // verifica se existe uma instalao anterior e desinstala if (FileExists('C:\vlibras-libs\unins000.exe')) then - if MsgBox( 'Existe uma verso anterior instalada neste computador. Ser necessrio remov-la antes de proceguir.', mbInformation, MB_okcancel) = idok then + if MsgBox( 'Existe uma verso anterior instalada neste computador. Ser necessrio remov-la antes de prosseguir.', mbInformation, MB_okcancel) = idok then begin ShellExec('', ExpandConstant('C:\vlibras-libs\unins000.exe'), '/SILENT', '', SW_SHOW, ewNoWait, ErrorCode); @@ -111,6 +112,7 @@ begin if CurStep = ssDone then begin + FileCopy(ExpandConstant('{app}\nltk_data\hunpos.py'), ExpandConstant('{sd}\Python27\Lib\site-packages\nltk\tag\hunpos.py'), False); FileCopy(ExpandConstant('{app}\nltk_data\data.py'), ExpandConstant('{sd}\Python27\Lib\site-packages\nltk\data.py'), False); FileCopy(ExpandConstant('{app}\nltk_data\nltk_tgrep.py'), ExpandConstant('{sd}\Python27\Lib\site-packages\nltk_tgrep.py'), False); @@ -118,7 +120,7 @@ begin if not ShellExec('', ExpandConstant('{app}\update\bin\DicionarioUp.exe'), '', '', SW_SHOW, ewNoWait, ErrorCode) then begin - MsgBox('O VLibras foi instalado com sucesso, porm o Dicionrio no foi instalado. Voc poder utilizar o VLibras Sem o Diciorio. Tente atualizar o programa para que o Dicionrio seja instalado. ', mbError, MB_OK); + MsgBox('O VLibras foi instalado com sucesso, porm o Dicionrio no foi instalado. Voc poder utilizar o VLibras sem o Diciorio. Tente atualizar o programa para que o dicionrio seja instalado. ', mbError, MB_OK); end; end; diff --git a/update/checkVersion.cpp b/update/checkVersion.cpp deleted file mode 100644 index fbb0e72..0000000 --- a/update/checkVersion.cpp +++ /dev/null @@ -1,133 +0,0 @@ - -#include -#include -#include -#include -#include -#include -#include -using namespace std; - -HINSTANCE hDLL1; -char* pPathTempJson; -char* pPathVlibrasJson; -int codDownload = -1; - -//Assinatura do método itd_downloadfile utilizado na dll -typedef int (WINAPI*download)(char * arg1, char * arg2); -download itd_downloadfile; - -ofstream versionFileCheck; - - - -//usado para representar as versoes tanto da api quanto local -typedef struct Versions -{ - char versionDicionario[7]={'0','0','0','0','0','0','\0'}; - char versionPlayer[4]={'0','0','0','\0'}; -} Version; - -// usado para carregar os jsons de versoes -Version loadVersion(char* pPathTempJson) -{ - Version version; - string line_in_str; - ifstream file_versionApi; - - int i; - try - { - file_versionApi.open(pPathTempJson); - while ( getline (file_versionApi, line_in_str) ) - { - if(strstr(line_in_str.c_str(), "playerVersion")){ - i = 0; - for (char & c : line_in_str) - if(isdigit(c)) - version.versionPlayer[i++]=c; - version.versionPlayer[i]='\0'; - } - else if(strstr(line_in_str.c_str(), "dictionaryVersion")){ - - i = 0; - for (char & c : line_in_str) - if(isdigit(c)) - version.versionDicionario[i++]=c; - version.versionDicionario[i]='\0'; - } - } - file_versionApi.close(); - } - catch (exception e) - { - - } - return version; -} - -void downloadFileJson(){ - - codDownload = itd_downloadfile("http://vlibras.lavid.ufpb.br/api/dicionario/0.0.0_0.0.0?type=json",pPathTempJson); -} - - - -int main(){ - - versionFileCheck.open ("c:\\VLibras\\update\\version\\version.txt"); - - pPathTempJson ="C:\\VLibras\\update\\download\\VLibrasVersionApi.json"; - pPathVlibrasJson = "c:\\VLibras\\version.json"; - //Carrega a dll - hDLL1 = LoadLibrary("c:\\VLibras\\update\\plugins\\itdownload.dll"); - //Relaciona método local com o método implementado na dll - itd_downloadfile=(download)GetProcAddress((HMODULE)hDLL1, "itd_downloadfile"); - - if (hDLL1){ - - //faz download do json de versao - thread tDownloadFileJson(downloadFileJson); - - clock_t time_end; - time_end = clock() + 3000 * CLOCKS_PER_SEC/1000; - while (clock() < time_end); - - if(codDownload == -1){ - versionFileCheck << "-1"; - goto erro; - } - tDownloadFileJson.join(); - - //verifica se existe os dois arquivos de versao - if(!ifstream(pPathTempJson) || !ifstream(pPathVlibrasJson) || (codDownload > 0 )){ - - versionFileCheck << "-1"; - goto erro; - } - - Version versionApi = loadVersion(pPathTempJson); - Version versionLocal = loadVersion(pPathVlibrasJson); - - // compara as versoes (return '0' para nao tem attualizacao, '1' para player e '2' para dicionario) - if(atoi(versionApi.versionPlayer)> atoi(versionLocal.versionPlayer)) - versionFileCheck << "1"; - else if(atoi(versionApi.versionDicionario)> atoi(versionLocal.versionDicionario)) - versionFileCheck << "2"; - else - versionFileCheck << "0"; - } - else - versionFileCheck << "-1"; - - - erro: - - - versionFileCheck.close(); - - //Libera dll - FreeLibrary((HMODULE)hDLL1); - return 1; - -} \ No newline at end of file diff --git a/update/include/pyVlibrasUpdate.h b/update/include/pyVlibrasUpdate.h deleted file mode 100644 index 69465aa..0000000 --- a/update/include/pyVlibrasUpdate.h +++ /dev/null @@ -1,31 +0,0 @@ -//***************************************************************** -/* - -Copyright (c) 2015 Ezequiel Silva -VLibras-Core group at LAViD, Federal University of Paraiba -*/ -//***************************************************************** - -/** -* \file pyVlibrasUpdate.h -* \authors Ezequiel Silva -* \date Setembro 2015 -*/ -#ifndef _PHVLIBRASUPDATE_H -#define _PHVLIBRASUPDATE_H - -#include - -/** \brief Classe para execução do Vlibras Update. -* -*/ -class PyVlibrasUpdate -{ - - public: - int install(char* strFunct, char* strstrParams); - void checkExe(char* strFunct, char* strstrParams); - -}; - -#endif \ No newline at end of file diff --git a/update/src/configureEnvironmentVariables.cpp b/update/src/configureEnvironmentVariables.cpp index e3369a2..de7692d 100644 --- a/update/src/configureEnvironmentVariables.cpp +++ b/update/src/configureEnvironmentVariables.cpp @@ -1,13 +1,11 @@  -/** -* \file configureEnvironmentVariable.cpp -* \author Ezequiel Silva -* \ email eseveriano@gmail.com -* \date Março 2016 -*/ - #include #include +/* + Seta as variáveis de ambitentes necessarias + Autor: ezequie silva + Email: eseveriano@gmail.com +*/ using namespace std; @@ -16,54 +14,61 @@ int main(int argc, char *argv[]){ char str[4096]; str[0]=0; - //pega o valor da variável de ambiente PATH FILE *fp = _popen("echo %PATH%","r"); char buf[1024]; - // concatena todos os valores + + while (fgets(buf, 1024, fp)) { strcat(str,buf); } - //guarda todos os itens que serao novamente setado na variável PATH + + + string path=""; char * pch; - //cada item da variável char item[1024]; - // inicio da verificação se existe algum item da variável relacionado com VLIBRAS pch = strtok (str,";"); while (pch != NULL) { strcpy(item,pch); if(!strstr(path.c_str(),item)) - { if(!(strstr(item,"vlibras") || strstr(item,"VLibras") || strstr(item,"Python27"))) + { if(!(strstr(item,"vlibras") || strstr(item,"VLibras") || strstr(item,"PYTHONPATH") || strstr(item,"Python27"))) { + path.append(pch); path.append(";"); - } + } + } + pch = strtok (NULL, ";"); } - - /*######FIM VERIFICAÇÂO######*/ - - // variáveis de ambiente a serem setadas -system("SETX PATH_VLIBRAS %HOMEDRIVE%\\VLibras /M"); -system("SETX AELIUS_DATA %PATH_VLIBRAS%\\aelius_data /M"); -system("SETX NLTK_DATA %PATH_VLIBRAS%\\nltk_data /M"); -system("SETX HUNPOS_TAGGER %PATH_VLIBRAS%\\bin\\hunpos-tag.exe /M"); -system("SETX TRANSLATE_DATA %PATH_VLIBRAS%\\translate\\data /M"); -system("SETX PYTHONPATH %HOMEDRIVE%\\Python27;%HOMEDRIVE%\\Python27\\Scripts;%HOMEDRIVE%\\Python27\\Lib\\site-packages;%PATH_VLIBRAS%;%PATH_VLIBRAS%\\bin;%PATH_VLIBRAS%\\translate\\src;%PATH_VLIBRAS%\\Clipboard;%PATH_VLIBRAS%\\update;%PATH_VLIBRAS%\\nltk_data;%PATH_VLIBRAS%\\Aelius /M"); - -string pathFinal="SETX \"PATH\" \""; -pathFinal.append("%PYTHONPATH%;"); +system("C:\\Windows\\System32\\SETX PATH_VLIBRAS %HOMEDRIVE%\\VLibras /M"); +system("C:\\Windows\\System32\\SETX AELIUS_DATA %PATH_VLIBRAS%\\aelius_data /M"); +system("C:\\Windows\\System32\\SETX NLTK_DATA %PATH_VLIBRAS%\\nltk_data /M"); +system("C:\\Windows\\System32\\SETX HUNPOS_TAGGER %PATH_VLIBRAS%\\bin\\hunpos-tag.exe /M"); +system("C:\\Windows\\System32\\SETX TRANSLATE_DATA %PATH_VLIBRAS%\\translate\\data /M"); +system("C:\\Windows\\System32\\SETX PYTHONPATH %HOMEDRIVE%\\Python27;%HOMEDRIVE%\\Python27\\Scripts;%HOMEDRIVE%\\Python27\\Lib\\site-packages;%PATH_VLIBRAS%;%PATH_VLIBRAS%\\bin;%PATH_VLIBRAS%\\translate\\src;%PATH_VLIBRAS%\\Clipboard;%PATH_VLIBRAS%\\update;%PATH_VLIBRAS%\\nltk_data;%PATH_VLIBRAS%\\Aelius /M"); + + + +string pathFinal="C:\\Windows\\System32\\SETX PATH \""; +pathFinal.append("%\"PYTHONPATH\"%;"); pathFinal.append(path); pathFinal.append("\" /M"); system(pathFinal.c_str()); -/*FIM SETA VARIÁVEIS DE AMBIENTE*/ + +pathFinal="C:\\Windows\\System32\\SETX \"PATH\" \""; +pathFinal.append("%\"PYTHONPATH\"%;"); +pathFinal.append(path); +pathFinal.append("\""); +system(pathFinal.c_str()); fclose(fp); + return 0; } diff --git a/update/src/pyVlibrasUpdate.cpp b/update/src/pyVlibrasUpdate.cpp deleted file mode 100644 index 0a8c0c7..0000000 --- a/update/src/pyVlibrasUpdate.cpp +++ /dev/null @@ -1,103 +0,0 @@ - -/** -* \file pyVlibrasUpdate.cpp -* \authors Ezequiel Silva -* \date outubro 2015 -*/ - -#include "pyVlibrasUpdate.h" - - -void PyVlibrasUpdate::checkExe(char* strFunct, char* strstrParams) -{ - - STARTUPINFO StartupInfo; - PROCESS_INFORMATION ProcessInfo; - char Args[4096]; - char *pEnvCMD = NULL; - char *pDefaultCMD = "CMD.EXE"; - ULONG rc; - - memset(&StartupInfo, 0, sizeof(StartupInfo)); - StartupInfo.cb = sizeof(STARTUPINFO); - StartupInfo.dwFlags = STARTF_USESHOWWINDOW; - StartupInfo.wShowWindow = SW_HIDE; - - Args[0] = 0; - - pEnvCMD = getenv("COMSPEC"); - - if(pEnvCMD){ - - strcpy(Args, pEnvCMD); - } - else{ - strcpy(Args, pDefaultCMD); - } - - // "/c" option - Do the command then terminate the command window - strcat(Args, " /c "); - //the application you would like to run from the command window - strcat(Args, strFunct); - strcat(Args, " "); - //the parameters passed to the application being run from the command window. - strcat(Args, strstrParams); - - if (!CreateProcess( NULL, Args, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) - { - return; - } - - WaitForSingleObject(ProcessInfo.hProcess, INFINITE); - if(!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) - rc = 0; - - CloseHandle(ProcessInfo.hThread); - CloseHandle(ProcessInfo.hProcess); - - -} - -int PyVlibrasUpdate::install(char* strFunct, char* strstrParams) -{ - - STARTUPINFO StartupInfo; - PROCESS_INFORMATION ProcessInfo; - char Args[4096]; - char *pEnvCMD = NULL; - char *pDefaultCMD = "CMD.EXE"; - - memset(&StartupInfo, 0, sizeof(StartupInfo)); - StartupInfo.cb = sizeof(STARTUPINFO); - StartupInfo.dwFlags = STARTF_USESHOWWINDOW; - StartupInfo.wShowWindow = SW_HIDE; - - Args[0] = 0; - - pEnvCMD = getenv("COMSPEC"); - - if(pEnvCMD){ - - strcpy(Args, pEnvCMD); - } - else{ - strcpy(Args, pDefaultCMD); - } - - // "/c" option - Do the command then terminate the command window - strcat(Args, " /c "); - //the application you would like to run from the command window - strcat(Args, strFunct); - strcat(Args, " "); - //the parameters passed to the application being run from the command window. - strcat(Args, strstrParams); - - if (!CreateProcess( NULL, Args, NULL, NULL, FALSE,CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) - { - return -1; - } - - return -1; - -} - -- libgit2 0.21.2