Revision 7890
branches/v10/install/launcher/izpack-launcher-1.3/dist/launcher-Win32.ini | ||
---|---|---|
11 | 11 |
; * #ARGS# cadena con todos los argumentos con los que se ha llamado al lanzador |
12 | 12 |
; * #ARG1#, #ARG2#, ... #ARG9#: parametro recivido en 'n' lugar |
13 | 13 |
; * #ARG0#: Nombre del ejecutable del lanzador |
14 |
; Tambien admite los valores de la seccion 'Variables' encerrados entre |
|
15 |
; el caracter almuadilla '#' |
|
16 |
; * Nota: los nombres de las variables son case sensitive |
|
14 | 17 |
command = #JAVA# -jar #JAR# |
15 | 18 |
|
16 | 19 |
|
... | ... | |
27 | 30 |
doChecks = YES |
28 | 31 |
|
29 | 32 |
; Ruta el Java_home a usar en caso de 'doChecks-->No' |
30 |
jre_home =
|
|
33 |
jre_home = |
|
31 | 34 |
;ejemplo: jre_home = C:/Archivos de programa/Java/j2re1.4.2_11 |
32 | 35 |
|
33 | 36 |
|
... | ... | |
80 | 83 |
; copiar antes de lanzar el comando. |
81 | 84 |
; Los ficheros se copiaran si no existen en el |
82 | 85 |
; destino. |
86 |
; Pueden usarse variables declaradas en la |
|
87 |
; seccion 'variables' colocadas entre '#' |
|
88 |
; * Nota: los nombres de las variables son case sensitive |
|
83 | 89 |
; Requiere los valores: |
84 | 90 |
; * source1: primer fichero origen |
85 | 91 |
; * target1: primer destino |
... | ... | |
97 | 103 |
|
98 | 104 |
source3= |
99 | 105 |
target3= |
106 |
|
|
107 |
|
|
108 |
; En esta seccion se pueden definir valores |
|
109 |
; que se pueden utilizar en el parametro 'command' |
|
110 |
; o en la copia de los ficheros |
|
111 |
; * Nota: los nombres son case sensitive |
|
112 |
[Variables] |
branches/v10/install/launcher/izpack-launcher-1.3/src/launcher.cpp | ||
---|---|---|
173 | 173 |
if ((!paramsDoChecks) && paramsJreHome == wxEmptyString) { |
174 | 174 |
error(cfgName.Format(_("The file entry 'jre_home' can not be empty when 'doChecks = No'."),cfgName.c_str())); |
175 | 175 |
} |
176 |
|
|
177 |
|
|
178 |
|
|
179 |
variables = sectionKeysFromINI("Variables"); |
|
180 |
|
|
181 |
variablesValues = sectionKeysValuesFromINI("Variables",variables); |
|
176 | 182 |
} |
177 | 183 |
|
178 | 184 |
void LauncherApp::error(const wxString &msg) |
179 | 185 |
{ |
180 | 186 |
wxMessageDialog dlg(0, msg, _(APPLICATION_NAME), wxOK | wxICON_ERROR); |
181 | 187 |
dlg.ShowModal(); |
188 |
printf(msg.c_str()); |
|
182 | 189 |
exit(1); |
183 | 190 |
} |
184 | 191 |
|
... | ... | |
838 | 845 |
|
839 | 846 |
|
840 | 847 |
wxString LauncherApp::parseCommand(){ |
841 |
wxString resultCommand(paramsCommand); |
|
842 | 848 |
|
849 |
return parseString(paramsCommand); |
|
850 |
} |
|
851 |
|
|
852 |
wxString LauncherApp::parseString(const wxString theString){ |
|
853 |
wxString resultCommand(theString); |
|
854 |
|
|
843 | 855 |
// #JAVA# |
844 | 856 |
resultCommand.Replace("#JAVA#",javaExecPath.c_str()); |
845 | 857 |
|
... | ... | |
875 | 887 |
|
876 | 888 |
// #ARG0# |
877 | 889 |
resultCommand.Replace("#ARG0#",argv[0]); |
890 |
|
|
891 |
// variables de la seccion variables |
|
892 |
|
|
893 |
//echo(resultCommand); |
|
894 |
|
|
895 |
// |
|
896 |
if (!variables.IsEmpty()){ |
|
897 |
//echo(theArg.Format("No empty: count =%i",keys.GetCount())); |
|
898 |
unsigned int i; |
|
899 |
for (i=0;i<variables.GetCount();i++){ |
|
900 |
//echo("#"+variables[i]+"#="+variablesValues[i]); |
|
901 |
resultCommand.Replace("#"+variables[i]+"#",variablesValues[i]); |
|
902 |
} |
|
903 |
|
|
904 |
//echo(resultCommand); |
|
905 |
|
|
906 |
} |
|
907 |
|
|
878 | 908 |
|
909 |
|
|
879 | 910 |
return resultCommand; |
880 | 911 |
} |
881 | 912 |
|
... | ... | |
904 | 935 |
error(source.Format(_("Error copying the file number %i:\n missing source or target entry"),i)); |
905 | 936 |
return false; |
906 | 937 |
} |
907 |
//source = escape_backSlash(source);
|
|
908 |
//target = escape_backSlash(target);
|
|
938 |
source = parseString(source);
|
|
939 |
target = parseString(target);
|
|
909 | 940 |
if (wxFileExists(target)){ |
910 | 941 |
continue; |
911 | 942 |
} |
... | ... | |
916 | 947 |
|
917 | 948 |
fileName = wxFileName(source); |
918 | 949 |
msg = msg.Format(_("copying %s..."), fileName.GetFullName().c_str()); |
950 |
//echo(msg); |
|
919 | 951 |
if (!copyFile(source,target, msg)){ |
920 | 952 |
error(source.Format(_("Error copying the file number %i:\n '%s' --> '%s'."),i,source.c_str(),target.c_str())); |
921 | 953 |
return false; |
... | ... | |
1072 | 1104 |
return readFromINI("default",key,defaultValue); |
1073 | 1105 |
} |
1074 | 1106 |
|
1107 |
wxArrayString LauncherApp::sectionKeysFromINI(const wxString section){ |
|
1108 |
char* charResult; |
|
1075 | 1109 |
|
1110 |
charResult =myGetPrivateProfileString(section.c_str(),NULL,NULL,cfgName.c_str()); |
|
1111 |
//echo(section +" = "+charResult); |
|
1076 | 1112 |
|
1113 |
wxArrayString rvalue; |
|
1114 |
char* token; |
|
1115 |
|
|
1116 |
for ( |
|
1117 |
token = strtok(charResult,"="); |
|
1118 |
token; |
|
1119 |
token = strtok(NULL,"=") |
|
1120 |
|
|
1121 |
) { |
|
1122 |
rvalue.Add(token); |
|
1123 |
} |
|
1124 |
return rvalue; |
|
1125 |
} |
|
1126 |
|
|
1127 |
|
|
1128 |
wxArrayString LauncherApp::sectionKeysValuesFromINI(const wxString section,wxArrayString keys) { |
|
1129 |
wxArrayString rvalue; |
|
1130 |
unsigned int i; |
|
1131 |
wxString key; |
|
1132 |
wxString value; |
|
1133 |
for (i=0;i < keys.GetCount(); i++){ |
|
1134 |
rvalue.Add(readPathFromINI( section, keys[i], "")); |
|
1135 |
} |
|
1136 |
return rvalue; |
|
1137 |
} |
|
1138 |
|
branches/v10/install/launcher/izpack-launcher-1.3/src/launcher.h | ||
---|---|---|
66 | 66 |
StatusDialog* statusDialog; |
67 | 67 |
bool isStatusDialogVisible; |
68 | 68 |
wxTimer* myTimer; |
69 |
|
|
70 |
wxArrayString variables; |
|
71 |
wxArrayString variablesValues; |
|
72 |
|
|
69 | 73 |
|
70 | 74 |
|
71 | 75 |
wxString paramsJreVersion; |
... | ... | |
130 | 134 |
|
131 | 135 |
wxString parseCommand(); |
132 | 136 |
|
137 |
wxString parseString(const wxString theString); |
|
138 |
|
|
133 | 139 |
bool copyRequiredFiles(); |
134 | 140 |
|
135 | 141 |
|
... | ... | |
141 | 147 |
|
142 | 148 |
wxString LauncherApp::readFromINI(wxString key, const wxString defaultValue); |
143 | 149 |
|
150 |
wxArrayString LauncherApp::sectionKeysFromINI(const wxString section); |
|
144 | 151 |
|
152 |
wxArrayString LauncherApp::sectionKeysValuesFromINI(const wxString section,wxArrayString keys); |
|
145 | 153 |
|
154 |
|
|
155 |
|
|
146 | 156 |
|
147 | 157 |
public: |
148 | 158 |
|
branches/v10/install/launcher/izpack-launcher-1.3/src/launcher.ini | ||
---|---|---|
11 | 11 |
; * #ARGS# cadena con todos los argumentos con los que se ha llamado al lanzador |
12 | 12 |
; * #ARG1#, #ARG2#, ... #ARG9#: parametro recivido en 'n' lugar |
13 | 13 |
; * #ARG0#: Nombre del ejecutable del lanzador |
14 |
; Tambien admite los valores de la seccion 'Variables' encerrados entre |
|
15 |
; el caracter almuadilla '#' |
|
16 |
; * Nota: los nombres de las variables son case sensitive |
|
14 | 17 |
command = #JAVA# -jar #JAR# |
15 | 18 |
|
16 | 19 |
|
... | ... | |
70 | 73 |
; copiar antes de lanzar el comando. |
71 | 74 |
; Los ficheros se copiaran si no existen en el |
72 | 75 |
; destino. |
76 |
; Pueden usarse variables declaradas en la |
|
77 |
; seccion 'variables' colocadas entre '#' |
|
78 |
; * Nota: los nombres de las variables son case sensitive |
|
73 | 79 |
; Requiere los valores: |
74 | 80 |
; * source1: primer fichero origen |
75 | 81 |
; * target1: primer destino |
... | ... | |
87 | 93 |
|
88 | 94 |
source3= |
89 | 95 |
target3= |
96 |
|
|
97 |
; En esta seccion se pueden definir valores |
|
98 |
; que se pueden utilizar en el parametro 'command' |
|
99 |
; o en la copia de los ficheros |
|
100 |
; * Nota: los nombres de las variables son case sensitive |
|
101 |
[Variables] |
Also available in: Unified diff