Commit 3ed6f51fcce09c3a70613aa85d4c6e8fed861f2e
1 parent
86e08239
Exists in
master
corrige alguns bugs versao 4.0.0
Showing
9 changed files
with
57 additions
and
444 deletions
Show diff stats
Clipboard/Clipboard.py
@@ -26,7 +26,7 @@ def clip(): | @@ -26,7 +26,7 @@ def clip(): | ||
26 | # Ativa bdrag | 26 | # Ativa bdrag |
27 | def bdragOn(): | 27 | def bdragOn(): |
28 | global process | 28 | global process |
29 | - process = subprocess.Popen("bdrag") | 29 | + process = subprocess.Popen("C:\\VLibras\\bin\\bdrag.exe") |
30 | 30 | ||
31 | # Finaliza bdrag | 31 | # Finaliza bdrag |
32 | def bdragOff(): | 32 | def bdragOff(): |
No preview for this file type
install/inno setup/user_install.bat
@@ -1,132 +0,0 @@ | @@ -1,132 +0,0 @@ | ||
1 | -::############################## Instalador VLibras ############################ | ||
2 | -::# # | ||
3 | -::# Bruno Santos # | ||
4 | -::# brunosantos@lavid.ufpb.br | ||
5 | -::# Ezequiel Silva # | ||
6 | -::# ezequielsilva@lavid.ufpb.br # | ||
7 | -::# # | ||
8 | -::############################################################################## | ||
9 | - | ||
10 | -::Define Título da janela do prompt | ||
11 | -TITLE Instalador VLibras Windows | ||
12 | - | ||
13 | -::Limpa a tela | ||
14 | -CLS | ||
15 | - | ||
16 | -::Desabilita mensagens | ||
17 | -@ECHO off | ||
18 | - | ||
19 | -ECHO ############### Instalando VLibras ############### | ||
20 | - | ||
21 | - | ||
22 | - | ||
23 | - | ||
24 | -set PATH_VLIBRAS="%HOMEDRIVE%\VLibras" | ||
25 | - | ||
26 | - | ||
27 | - | ||
28 | -::################# Variáveis de Ambiente ################# | ||
29 | -ECHO Exportando Variaveis de Ambiente: | ||
30 | - | ||
31 | -ECHO AELIUS_DATA | ||
32 | -SETX AELIUS_DATA %PATH_VLIBRAS%\aelius_data /M | ||
33 | - | ||
34 | -ECHO NLTK_DATA | ||
35 | -SETX NLTK_DATA %PATH_VLIBRAS%\nltk_data /M | ||
36 | - | ||
37 | -ECHO HUNPOS_TAGGER | ||
38 | -SETX HUNPOS_TAGGER %PATH_VLIBRAS%\bin\hunpos-tag.exe /M | ||
39 | - | ||
40 | -ECHO TRANSLATE_DATA | ||
41 | -SETX TRANSLATE_DATA %PATH_VLIBRAS%\translate\data /M | ||
42 | - | ||
43 | -ECHO PYTHONPATH | ||
44 | -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 | ||
45 | - | ||
46 | -@echo off | ||
47 | -set path_value=%PATH% | ||
48 | - | ||
49 | -::ECHO PATH | ||
50 | -::SETX PATH %PATH_VLIBRAS%\bin;%HOMEDRIVE%\Python27;%HOMEDRIVE%\Python27\Scripts;%HOMEDRIVE%\Python27\Lib\site-packages /M | ||
51 | - | ||
52 | - | ||
53 | - | ||
54 | - | ||
55 | - | ||
56 | -SET MYPATHCOPY=%PATH% | ||
57 | -SET PATH_COPY= | ||
58 | -SET ENCONTRADO="NO" | ||
59 | - | ||
60 | - | ||
61 | -:search | ||
62 | -for /f "delims=; tokens=1,2*" %%p in ("%MYPATHCOPY%") do ( | ||
63 | - | ||
64 | - ECHO.%%~p | FIND /I "ibras" >Nul && ( | ||
65 | - Echo %%~p | ||
66 | - ) || ( | ||
67 | - | ||
68 | - ECHO.%%~p | FIND /I "Python27" >Nul && ( | ||
69 | - Echo %%~p | ||
70 | - ) || ( | ||
71 | - SET "PATH_COPY=%%~p;%PATH_COPY%" | ||
72 | - ) | ||
73 | - ) | ||
74 | - | ||
75 | - SET MYPATHCOPY=%%~q;%%~r | ||
76 | -) | ||
77 | - | ||
78 | -if "%MYPATHCOPY%"==";" goto done; | ||
79 | -goto search; | ||
80 | - | ||
81 | -:done | ||
82 | - | ||
83 | - | ||
84 | -SETX "PATH" "%PATH_COPY%;%%PYTHONPATH%%" /M | ||
85 | -SETX "PATH" "%PATH_COPY%;%%PYTHONPATH%%" | ||
86 | - | ||
87 | -echo %PATH% | ||
88 | - | ||
89 | -::################# Instalação do Python ################# | ||
90 | -::msiexec /i python-2.7.9.msi /passive | ||
91 | -::ECHO OK | ||
92 | - | ||
93 | -::################# Dependências ################# | ||
94 | - | ||
95 | - | ||
96 | -c:\Python27\python.exe pip-6.0.8-py2.py3-none-any.whl/pip install pip-6.0.8-py2.py3-none-any.whl | ||
97 | -ECHO OK | ||
98 | - | ||
99 | - | ||
100 | -c:\Python27\Scripts\pip install PyYAML-3.11-cp27-none-win32.whl | ||
101 | -ECHO OK | ||
102 | - | ||
103 | -c:\Python27\Scripts\pip install numpy-1.9.2+mkl-cp27-none-win32.whl | ||
104 | -ECHO OK | ||
105 | - | ||
106 | -c:\Python27\Scripts\pip install six-1.9.0-py2.py3-none-any.whl | ||
107 | -ECHO OK | ||
108 | - | ||
109 | -c:\Python27\Scripts\pip install pyparsing-2.0.3-py2-none-any.whl | ||
110 | -ECHO OK | ||
111 | - | ||
112 | -c:\Python27\Scripts\pip install pytz-2014.10-py2.py3-none-any.whl | ||
113 | -ECHO OK | ||
114 | - | ||
115 | -c:\Python27\Scripts\pip install python_dateutil-2.4.0-py2.py3-none-any.whl | ||
116 | -ECHO OK | ||
117 | - | ||
118 | -c:\Python27\Scripts\pip install matplotlib-1.4.3-cp27-none-win32.whl | ||
119 | -ECHO OK | ||
120 | - | ||
121 | -c:\Python27\Scripts\pip install nltk-3.0.2-py2.py3-none-any.whl | ||
122 | -ECHO OK | ||
123 | - | ||
124 | -c:\Python27\Scripts\pip install future-0.14.3-py2-none-any.whl | ||
125 | -ECHO OK | ||
126 | - | ||
127 | -::################# HUNPOS.PY & DATA.PY ############################# | ||
128 | -COPY %PATH_VLIBRAS%\nltk_data\hunpos.py %homedrive%\Python27\Lib\site-packages\nltk\tag\ /y | ||
129 | -COPY %PATH_VLIBRAS%\nltk_data\data.py %homedrive%\Python27\Lib\site-packages\nltk /y | ||
130 | -COPY %PATH_VLIBRAS%\nltk_data\nltk_tgrep.py %homedrive%\Python27\Lib\site-packages /y | ||
131 | - | ||
132 | -ECHO VLibras Tradutor instalado com sucesso! |
install/inno setup/user_install.iss
@@ -58,22 +58,23 @@ Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; | @@ -58,22 +58,23 @@ Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; | ||
58 | Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; Tasks: quicklaunchicon; IconFilename: "{app}\icons\icon_vlibras.ico" | 58 | Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; Tasks: quicklaunchicon; IconFilename: "{app}\icons\icon_vlibras.ico" |
59 | 59 | ||
60 | [Run] | 60 | [Run] |
61 | -Filename: {tmp}\configureEnvironmentVariables.exe ; Flags: runhidden; StatusMsg: Definindo variáveis de ambiente... | ||
62 | -Filename: msiexec ; Flags: runhidden; Parameters: /i {tmp}\python-2.7.9.msi /passive; StatusMsg: Instalando python-2.7.9... | ||
63 | -Filename: {tmp}\required\user_install.bat; Flags: runhidden; StatusMsg: Instalando dependências... | ||
64 | - | ||
65 | -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... | ||
66 | -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\PyYAML-3.11-cp27-none-win32.whl; StatusMsg: Instalando PyYAML... | ||
67 | -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\numpy-1.9.2+mkl-cp27-none-win32.whl; StatusMsg: Instalando numpy... | ||
68 | -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\six-1.9.0-py2.py3-none-any.whl; StatusMsg: Instalando six... | ||
69 | -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\pyparsing-2.0.3-py2-none-any.whl; StatusMsg: Instalando pyparsing... | ||
70 | -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\pytz-2014.10-py2.py3-none-any.whl; StatusMsg: Instalando pytz... | ||
71 | -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\python_dateutil-2.4.0-py2.py3-none-any.whl; StatusMsg: Instalando python_dateutil... | ||
72 | -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\matplotlib-1.4.3-cp27-none-win32.whl; StatusMsg: Instalando matplotlib... | ||
73 | -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\nltk-3.0.2-py2.py3-none-any.whl; StatusMsg: Instalando nltk... | ||
74 | -Filename: pip ; Flags: runhidden; Parameters: install {tmp}\required\future-0.14.3-py2-none-any.whl; StatusMsg: Instalando future... | ||
75 | 61 | ||
62 | +Filename: msiexec ; Flags: runhidden; Parameters: /i {tmp}\python-2.7.9.msi /passive; StatusMsg: Instalando dependências... | ||
63 | + | ||
64 | +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 dependências... | ||
65 | +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\PyYAML-3.11-cp27-none-win32.whl; StatusMsg: Instalando dependências... | ||
66 | +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\numpy-1.9.2+mkl-cp27-none-win32.whl; StatusMsg: Instalando dependências... | ||
67 | +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\six-1.9.0-py2.py3-none-any.whl; StatusMsg: Instalando dependências... | ||
68 | +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\pyparsing-2.0.3-py2-none-any.whl; StatusMsg: Instalando dependências... | ||
69 | +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\pytz-2014.10-py2.py3-none-any.whl; StatusMsg: Instalando dependências... | ||
70 | +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\python_dateutil-2.4.0-py2.py3-none-any.whl; StatusMsg: Instalando dependências... | ||
71 | +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\matplotlib-1.4.3-cp27-none-win32.whl; StatusMsg: Instalando dependências... | ||
72 | +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\nltk-3.0.2-py2.py3-none-any.whl; StatusMsg: Instalando dependências... | ||
73 | +Filename: c:\Python27\Scripts\pip ; Flags: runhidden; Parameters: install {tmp}\required\future-0.14.3-py2-none-any.whl; StatusMsg: Instalando dependências... | ||
74 | +Filename: {tmp}\configureEnvironmentVariables.exe ; Flags: runhidden; StatusMsg: Definindo variáveis de ambiente... | ||
76 | 75 | ||
76 | +[UninstallDelete] | ||
77 | +Type: filesandordirs; Name: "{app}" | ||
77 | 78 | ||
78 | [Code] | 79 | [Code] |
79 | 80 | ||
@@ -88,7 +89,7 @@ begin | @@ -88,7 +89,7 @@ begin | ||
88 | MyProgChecked:= True; | 89 | MyProgChecked:= True; |
89 | // verifica se existe uma instalação anterior e desinstala | 90 | // verifica se existe uma instalação anterior e desinstala |
90 | if (FileExists('C:\vlibras-libs\unins000.exe')) then | 91 | if (FileExists('C:\vlibras-libs\unins000.exe')) then |
91 | - if MsgBox( 'Existe uma versão anterior instalada neste computador. Será necessário remové-la antes de proceguir.', mbInformation, MB_okcancel) = idok then | 92 | + if MsgBox( 'Existe uma versão anterior instalada neste computador. Será necessário remové-la antes de prosseguir.', mbInformation, MB_okcancel) = idok then |
92 | begin | 93 | begin |
93 | ShellExec('', ExpandConstant('C:\vlibras-libs\unins000.exe'), '/SILENT', '', SW_SHOW, ewNoWait, ErrorCode); | 94 | ShellExec('', ExpandConstant('C:\vlibras-libs\unins000.exe'), '/SILENT', '', SW_SHOW, ewNoWait, ErrorCode); |
94 | 95 | ||
@@ -111,6 +112,7 @@ begin | @@ -111,6 +112,7 @@ begin | ||
111 | 112 | ||
112 | if CurStep = ssDone then | 113 | if CurStep = ssDone then |
113 | begin | 114 | begin |
115 | + | ||
114 | FileCopy(ExpandConstant('{app}\nltk_data\hunpos.py'), ExpandConstant('{sd}\Python27\Lib\site-packages\nltk\tag\hunpos.py'), False); | 116 | FileCopy(ExpandConstant('{app}\nltk_data\hunpos.py'), ExpandConstant('{sd}\Python27\Lib\site-packages\nltk\tag\hunpos.py'), False); |
115 | FileCopy(ExpandConstant('{app}\nltk_data\data.py'), ExpandConstant('{sd}\Python27\Lib\site-packages\nltk\data.py'), False); | 117 | FileCopy(ExpandConstant('{app}\nltk_data\data.py'), ExpandConstant('{sd}\Python27\Lib\site-packages\nltk\data.py'), False); |
116 | FileCopy(ExpandConstant('{app}\nltk_data\nltk_tgrep.py'), ExpandConstant('{sd}\Python27\Lib\site-packages\nltk_tgrep.py'), False); | 118 | FileCopy(ExpandConstant('{app}\nltk_data\nltk_tgrep.py'), ExpandConstant('{sd}\Python27\Lib\site-packages\nltk_tgrep.py'), False); |
@@ -118,7 +120,7 @@ begin | @@ -118,7 +120,7 @@ begin | ||
118 | 120 | ||
119 | if not ShellExec('', ExpandConstant('{app}\update\bin\DicionarioUp.exe'), '', '', SW_SHOW, ewNoWait, ErrorCode) then | 121 | if not ShellExec('', ExpandConstant('{app}\update\bin\DicionarioUp.exe'), '', '', SW_SHOW, ewNoWait, ErrorCode) then |
120 | begin | 122 | begin |
121 | - MsgBox('O VLibras foi instalado com sucesso, porém o Dicionário não foi instalado. Você poderá utilizar o VLibras Sem o Dicioário. Tente atualizar o programa para que o Dicionário seja instalado. ', mbError, MB_OK); | 123 | + MsgBox('O VLibras foi instalado com sucesso, porém o Dicionário não foi instalado. Você poderá utilizar o VLibras sem o Dicioário. Tente atualizar o programa para que o dicionário seja instalado. ', mbError, MB_OK); |
122 | end; | 124 | end; |
123 | end; | 125 | end; |
124 | 126 |
update/checkVersion.cpp
@@ -1,133 +0,0 @@ | @@ -1,133 +0,0 @@ | ||
1 | - | ||
2 | -#include <time.h> | ||
3 | -#include <fstream> | ||
4 | -#include <string> | ||
5 | -#include <cstdlib> | ||
6 | -#include <IOSTREAM> | ||
7 | -#include <windows.h> | ||
8 | -#include <thread> | ||
9 | -using namespace std; | ||
10 | - | ||
11 | -HINSTANCE hDLL1; | ||
12 | -char* pPathTempJson; | ||
13 | -char* pPathVlibrasJson; | ||
14 | -int codDownload = -1; | ||
15 | - | ||
16 | -//Assinatura do método itd_downloadfile utilizado na dll | ||
17 | -typedef int (WINAPI*download)(char * arg1, char * arg2); | ||
18 | -download itd_downloadfile; | ||
19 | - | ||
20 | -ofstream versionFileCheck; | ||
21 | - | ||
22 | - | ||
23 | - | ||
24 | -//usado para representar as versoes tanto da api quanto local | ||
25 | -typedef struct Versions | ||
26 | -{ | ||
27 | - char versionDicionario[7]={'0','0','0','0','0','0','\0'}; | ||
28 | - char versionPlayer[4]={'0','0','0','\0'}; | ||
29 | -} Version; | ||
30 | - | ||
31 | -// usado para carregar os jsons de versoes | ||
32 | -Version loadVersion(char* pPathTempJson) | ||
33 | -{ | ||
34 | - Version version; | ||
35 | - string line_in_str; | ||
36 | - ifstream file_versionApi; | ||
37 | - | ||
38 | - int i; | ||
39 | - try | ||
40 | - { | ||
41 | - file_versionApi.open(pPathTempJson); | ||
42 | - while ( getline (file_versionApi, line_in_str) ) | ||
43 | - { | ||
44 | - if(strstr(line_in_str.c_str(), "playerVersion")){ | ||
45 | - i = 0; | ||
46 | - for (char & c : line_in_str) | ||
47 | - if(isdigit(c)) | ||
48 | - version.versionPlayer[i++]=c; | ||
49 | - version.versionPlayer[i]='\0'; | ||
50 | - } | ||
51 | - else if(strstr(line_in_str.c_str(), "dictionaryVersion")){ | ||
52 | - | ||
53 | - i = 0; | ||
54 | - for (char & c : line_in_str) | ||
55 | - if(isdigit(c)) | ||
56 | - version.versionDicionario[i++]=c; | ||
57 | - version.versionDicionario[i]='\0'; | ||
58 | - } | ||
59 | - } | ||
60 | - file_versionApi.close(); | ||
61 | - } | ||
62 | - catch (exception e) | ||
63 | - { | ||
64 | - | ||
65 | - } | ||
66 | - return version; | ||
67 | -} | ||
68 | - | ||
69 | -void downloadFileJson(){ | ||
70 | - | ||
71 | - codDownload = itd_downloadfile("http://vlibras.lavid.ufpb.br/api/dicionario/0.0.0_0.0.0?type=json",pPathTempJson); | ||
72 | -} | ||
73 | - | ||
74 | - | ||
75 | - | ||
76 | -int main(){ | ||
77 | - | ||
78 | - versionFileCheck.open ("c:\\VLibras\\update\\version\\version.txt"); | ||
79 | - | ||
80 | - pPathTempJson ="C:\\VLibras\\update\\download\\VLibrasVersionApi.json"; | ||
81 | - pPathVlibrasJson = "c:\\VLibras\\version.json"; | ||
82 | - //Carrega a dll | ||
83 | - hDLL1 = LoadLibrary("c:\\VLibras\\update\\plugins\\itdownload.dll"); | ||
84 | - //Relaciona método local com o método implementado na dll | ||
85 | - itd_downloadfile=(download)GetProcAddress((HMODULE)hDLL1, "itd_downloadfile"); | ||
86 | - | ||
87 | - if (hDLL1){ | ||
88 | - | ||
89 | - //faz download do json de versao | ||
90 | - thread tDownloadFileJson(downloadFileJson); | ||
91 | - | ||
92 | - clock_t time_end; | ||
93 | - time_end = clock() + 3000 * CLOCKS_PER_SEC/1000; | ||
94 | - while (clock() < time_end); | ||
95 | - | ||
96 | - if(codDownload == -1){ | ||
97 | - versionFileCheck << "-1"; | ||
98 | - goto erro; | ||
99 | - } | ||
100 | - tDownloadFileJson.join(); | ||
101 | - | ||
102 | - //verifica se existe os dois arquivos de versao | ||
103 | - if(!ifstream(pPathTempJson) || !ifstream(pPathVlibrasJson) || (codDownload > 0 )){ | ||
104 | - | ||
105 | - versionFileCheck << "-1"; | ||
106 | - goto erro; | ||
107 | - } | ||
108 | - | ||
109 | - Version versionApi = loadVersion(pPathTempJson); | ||
110 | - Version versionLocal = loadVersion(pPathVlibrasJson); | ||
111 | - | ||
112 | - // compara as versoes (return '0' para nao tem attualizacao, '1' para player e '2' para dicionario) | ||
113 | - if(atoi(versionApi.versionPlayer)> atoi(versionLocal.versionPlayer)) | ||
114 | - versionFileCheck << "1"; | ||
115 | - else if(atoi(versionApi.versionDicionario)> atoi(versionLocal.versionDicionario)) | ||
116 | - versionFileCheck << "2"; | ||
117 | - else | ||
118 | - versionFileCheck << "0"; | ||
119 | - } | ||
120 | - else | ||
121 | - versionFileCheck << "-1"; | ||
122 | - | ||
123 | - | ||
124 | - erro: | ||
125 | - | ||
126 | - | ||
127 | - versionFileCheck.close(); | ||
128 | - | ||
129 | - //Libera dll | ||
130 | - FreeLibrary((HMODULE)hDLL1); | ||
131 | - return 1; | ||
132 | - | ||
133 | -} | ||
134 | \ No newline at end of file | 0 | \ No newline at end of file |
update/include/pyVlibrasUpdate.h
@@ -1,31 +0,0 @@ | @@ -1,31 +0,0 @@ | ||
1 | -//***************************************************************** | ||
2 | -/* | ||
3 | - | ||
4 | -Copyright (c) 2015 Ezequiel Silva | ||
5 | -VLibras-Core group at LAViD, Federal University of Paraiba | ||
6 | -*/ | ||
7 | -//***************************************************************** | ||
8 | - | ||
9 | -/** | ||
10 | -* \file pyVlibrasUpdate.h | ||
11 | -* \authors Ezequiel Silva | ||
12 | -* \date Setembro 2015 | ||
13 | -*/ | ||
14 | -#ifndef _PHVLIBRASUPDATE_H | ||
15 | -#define _PHVLIBRASUPDATE_H | ||
16 | - | ||
17 | -#include <windows.h> | ||
18 | - | ||
19 | -/** \brief Classe para execução do Vlibras Update. | ||
20 | -* | ||
21 | -*/ | ||
22 | -class PyVlibrasUpdate | ||
23 | -{ | ||
24 | - | ||
25 | - public: | ||
26 | - int install(char* strFunct, char* strstrParams); | ||
27 | - void checkExe(char* strFunct, char* strstrParams); | ||
28 | - | ||
29 | -}; | ||
30 | - | ||
31 | -#endif | ||
32 | \ No newline at end of file | 0 | \ No newline at end of file |
update/src/configureEnvironmentVariables.cpp
1 | | 1 | |
2 | -/** | ||
3 | -* \file configureEnvironmentVariable.cpp | ||
4 | -* \author Ezequiel Silva | ||
5 | -* \ email eseveriano@gmail.com | ||
6 | -* \date Março 2016 | ||
7 | -*/ | ||
8 | - | ||
9 | #include <string> | 2 | #include <string> |
10 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | +/* | ||
5 | + Seta as variáveis de ambitentes necessarias | ||
6 | + Autor: ezequie silva | ||
7 | + Email: eseveriano@gmail.com | ||
8 | +*/ | ||
11 | 9 | ||
12 | using namespace std; | 10 | using namespace std; |
13 | 11 | ||
@@ -16,54 +14,61 @@ int main(int argc, char *argv[]){ | @@ -16,54 +14,61 @@ int main(int argc, char *argv[]){ | ||
16 | 14 | ||
17 | char str[4096]; | 15 | char str[4096]; |
18 | str[0]=0; | 16 | str[0]=0; |
19 | - //pega o valor da variável de ambiente PATH | ||
20 | FILE *fp = _popen("echo %PATH%","r"); | 17 | FILE *fp = _popen("echo %PATH%","r"); |
21 | char buf[1024]; | 18 | char buf[1024]; |
22 | - // concatena todos os valores | 19 | + |
20 | + | ||
23 | while (fgets(buf, 1024, fp)) { | 21 | while (fgets(buf, 1024, fp)) { |
24 | strcat(str,buf); | 22 | strcat(str,buf); |
25 | } | 23 | } |
26 | - //guarda todos os itens que serao novamente setado na variável PATH | 24 | + |
25 | + | ||
26 | + | ||
27 | string path=""; | 27 | string path=""; |
28 | 28 | ||
29 | char * pch; | 29 | char * pch; |
30 | - //cada item da variável | ||
31 | char item[1024]; | 30 | char item[1024]; |
32 | 31 | ||
33 | - // inicio da verificação se existe algum item da variável relacionado com VLIBRAS | ||
34 | pch = strtok (str,";"); | 32 | pch = strtok (str,";"); |
35 | while (pch != NULL) | 33 | while (pch != NULL) |
36 | { | 34 | { |
37 | strcpy(item,pch); | 35 | strcpy(item,pch); |
38 | if(!strstr(path.c_str(),item)) | 36 | if(!strstr(path.c_str(),item)) |
39 | - { if(!(strstr(item,"vlibras") || strstr(item,"VLibras") || strstr(item,"Python27"))) | 37 | + { if(!(strstr(item,"vlibras") || strstr(item,"VLibras") || strstr(item,"PYTHONPATH") || strstr(item,"Python27"))) |
40 | { | 38 | { |
39 | + | ||
41 | path.append(pch); | 40 | path.append(pch); |
42 | path.append(";"); | 41 | path.append(";"); |
43 | - } | 42 | + } |
43 | + | ||
44 | } | 44 | } |
45 | + | ||
45 | pch = strtok (NULL, ";"); | 46 | pch = strtok (NULL, ";"); |
46 | } | 47 | } |
47 | - | ||
48 | - /*######FIM VERIFICAÇÂO######*/ | ||
49 | - | ||
50 | - // variáveis de ambiente a serem setadas | ||
51 | -system("SETX PATH_VLIBRAS %HOMEDRIVE%\\VLibras /M"); | ||
52 | -system("SETX AELIUS_DATA %PATH_VLIBRAS%\\aelius_data /M"); | ||
53 | -system("SETX NLTK_DATA %PATH_VLIBRAS%\\nltk_data /M"); | ||
54 | -system("SETX HUNPOS_TAGGER %PATH_VLIBRAS%\\bin\\hunpos-tag.exe /M"); | ||
55 | -system("SETX TRANSLATE_DATA %PATH_VLIBRAS%\\translate\\data /M"); | ||
56 | -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"); | ||
57 | - | ||
58 | -string pathFinal="SETX \"PATH\" \""; | ||
59 | -pathFinal.append("%PYTHONPATH%;"); | 48 | +system("C:\\Windows\\System32\\SETX PATH_VLIBRAS %HOMEDRIVE%\\VLibras /M"); |
49 | +system("C:\\Windows\\System32\\SETX AELIUS_DATA %PATH_VLIBRAS%\\aelius_data /M"); | ||
50 | +system("C:\\Windows\\System32\\SETX NLTK_DATA %PATH_VLIBRAS%\\nltk_data /M"); | ||
51 | +system("C:\\Windows\\System32\\SETX HUNPOS_TAGGER %PATH_VLIBRAS%\\bin\\hunpos-tag.exe /M"); | ||
52 | +system("C:\\Windows\\System32\\SETX TRANSLATE_DATA %PATH_VLIBRAS%\\translate\\data /M"); | ||
53 | +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"); | ||
54 | + | ||
55 | + | ||
56 | + | ||
57 | +string pathFinal="C:\\Windows\\System32\\SETX PATH \""; | ||
58 | +pathFinal.append("%\"PYTHONPATH\"%;"); | ||
60 | pathFinal.append(path); | 59 | pathFinal.append(path); |
61 | pathFinal.append("\" /M"); | 60 | pathFinal.append("\" /M"); |
62 | system(pathFinal.c_str()); | 61 | system(pathFinal.c_str()); |
63 | 62 | ||
64 | -/*FIM SETA VARIÁVEIS DE AMBIENTE*/ | 63 | + |
64 | +pathFinal="C:\\Windows\\System32\\SETX \"PATH\" \""; | ||
65 | +pathFinal.append("%\"PYTHONPATH\"%;"); | ||
66 | +pathFinal.append(path); | ||
67 | +pathFinal.append("\""); | ||
68 | +system(pathFinal.c_str()); | ||
65 | 69 | ||
66 | fclose(fp); | 70 | fclose(fp); |
67 | 71 | ||
72 | + | ||
68 | return 0; | 73 | return 0; |
69 | } | 74 | } |
update/src/pyVlibrasUpdate.cpp
@@ -1,103 +0,0 @@ | @@ -1,103 +0,0 @@ | ||
1 | - | ||
2 | -/** | ||
3 | -* \file pyVlibrasUpdate.cpp | ||
4 | -* \authors Ezequiel Silva | ||
5 | -* \date outubro 2015 | ||
6 | -*/ | ||
7 | - | ||
8 | -#include "pyVlibrasUpdate.h" | ||
9 | - | ||
10 | - | ||
11 | -void PyVlibrasUpdate::checkExe(char* strFunct, char* strstrParams) | ||
12 | -{ | ||
13 | - | ||
14 | - STARTUPINFO StartupInfo; | ||
15 | - PROCESS_INFORMATION ProcessInfo; | ||
16 | - char Args[4096]; | ||
17 | - char *pEnvCMD = NULL; | ||
18 | - char *pDefaultCMD = "CMD.EXE"; | ||
19 | - ULONG rc; | ||
20 | - | ||
21 | - memset(&StartupInfo, 0, sizeof(StartupInfo)); | ||
22 | - StartupInfo.cb = sizeof(STARTUPINFO); | ||
23 | - StartupInfo.dwFlags = STARTF_USESHOWWINDOW; | ||
24 | - StartupInfo.wShowWindow = SW_HIDE; | ||
25 | - | ||
26 | - Args[0] = 0; | ||
27 | - | ||
28 | - pEnvCMD = getenv("COMSPEC"); | ||
29 | - | ||
30 | - if(pEnvCMD){ | ||
31 | - | ||
32 | - strcpy(Args, pEnvCMD); | ||
33 | - } | ||
34 | - else{ | ||
35 | - strcpy(Args, pDefaultCMD); | ||
36 | - } | ||
37 | - | ||
38 | - // "/c" option - Do the command then terminate the command window | ||
39 | - strcat(Args, " /c "); | ||
40 | - //the application you would like to run from the command window | ||
41 | - strcat(Args, strFunct); | ||
42 | - strcat(Args, " "); | ||
43 | - //the parameters passed to the application being run from the command window. | ||
44 | - strcat(Args, strstrParams); | ||
45 | - | ||
46 | - if (!CreateProcess( NULL, Args, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) | ||
47 | - { | ||
48 | - return; | ||
49 | - } | ||
50 | - | ||
51 | - WaitForSingleObject(ProcessInfo.hProcess, INFINITE); | ||
52 | - if(!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) | ||
53 | - rc = 0; | ||
54 | - | ||
55 | - CloseHandle(ProcessInfo.hThread); | ||
56 | - CloseHandle(ProcessInfo.hProcess); | ||
57 | - | ||
58 | - | ||
59 | -} | ||
60 | - | ||
61 | -int PyVlibrasUpdate::install(char* strFunct, char* strstrParams) | ||
62 | -{ | ||
63 | - | ||
64 | - STARTUPINFO StartupInfo; | ||
65 | - PROCESS_INFORMATION ProcessInfo; | ||
66 | - char Args[4096]; | ||
67 | - char *pEnvCMD = NULL; | ||
68 | - char *pDefaultCMD = "CMD.EXE"; | ||
69 | - | ||
70 | - memset(&StartupInfo, 0, sizeof(StartupInfo)); | ||
71 | - StartupInfo.cb = sizeof(STARTUPINFO); | ||
72 | - StartupInfo.dwFlags = STARTF_USESHOWWINDOW; | ||
73 | - StartupInfo.wShowWindow = SW_HIDE; | ||
74 | - | ||
75 | - Args[0] = 0; | ||
76 | - | ||
77 | - pEnvCMD = getenv("COMSPEC"); | ||
78 | - | ||
79 | - if(pEnvCMD){ | ||
80 | - | ||
81 | - strcpy(Args, pEnvCMD); | ||
82 | - } | ||
83 | - else{ | ||
84 | - strcpy(Args, pDefaultCMD); | ||
85 | - } | ||
86 | - | ||
87 | - // "/c" option - Do the command then terminate the command window | ||
88 | - strcat(Args, " /c "); | ||
89 | - //the application you would like to run from the command window | ||
90 | - strcat(Args, strFunct); | ||
91 | - strcat(Args, " "); | ||
92 | - //the parameters passed to the application being run from the command window. | ||
93 | - strcat(Args, strstrParams); | ||
94 | - | ||
95 | - if (!CreateProcess( NULL, Args, NULL, NULL, FALSE,CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) | ||
96 | - { | ||
97 | - return -1; | ||
98 | - } | ||
99 | - | ||
100 | - return -1; | ||
101 | - | ||
102 | -} | ||
103 | - |