Commit 29ce453957d3eb4ac794deeee4e18cba9ec4bd96
1 parent
773a749c
Exists in
develop
Searching for datafiles on all win32 possible paths.
Showing
5 changed files
with
86 additions
and
17 deletions
Show diff stats
configure.ac
locale/pt_BR.po
... | ... | @@ -5,7 +5,7 @@ msgid "" |
5 | 5 | msgstr "" |
6 | 6 | "Project-Id-Version: pw3270 5.0\n" |
7 | 7 | "Report-Msgid-Bugs-To: \n" |
8 | -"POT-Creation-Date: 2023-03-13 03:12-0300\n" | |
8 | +"POT-Creation-Date: 2023-03-28 21:15-0300\n" | |
9 | 9 | "PO-Revision-Date: 2021-09-01 23:53-0300\n" |
10 | 10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" |
11 | 11 | "Language-Team: Português <perry.werneck@gmail.com>\n" |
... | ... | @@ -2071,7 +2071,7 @@ msgstr "Aguardando resposta do pedido de upload" |
2071 | 2071 | msgid "Warning" |
2072 | 2072 | msgstr "Alerta" |
2073 | 2073 | |
2074 | -#: src/core/windows/util.c:126 src/core/windows/util.c:169 | |
2074 | +#: src/core/windows/util.c:123 src/core/windows/util.c:166 | |
2075 | 2075 | #, c-format |
2076 | 2076 | msgid "Windows error %d" |
2077 | 2077 | msgstr "Erro windows foi %d" | ... | ... |
src/core/windows/util.c
... | ... | @@ -219,15 +219,23 @@ LIB3270_EXPORT const char * lib3270_win32_local_charset(void) { |
219 | 219 | #define SECS_TO_100NS 10000000ULL /* 10^7 */ |
220 | 220 | |
221 | 221 | LIB3270_EXPORT char * lib3270_get_installation_path() { |
222 | - char lpFilename[4096]; | |
222 | + char lpFilename[MAX_PATH]; | |
223 | 223 | |
224 | 224 | memset(lpFilename,0,sizeof(lpFilename)); |
225 | 225 | DWORD szPath = GetModuleFileName(hModule,lpFilename,sizeof(lpFilename)); |
226 | 226 | lpFilename[szPath] = 0; |
227 | 227 | |
228 | - char * ptr = strrchr(lpFilename,'\\'); | |
229 | - if(ptr) | |
230 | - ptr[1] = 0; | |
228 | + char *ptr = strrchr(lpFilename,'\\'); | |
229 | + if(ptr) { | |
230 | + ptr[0] = 0; | |
231 | + | |
232 | + ptr = strrchr(lpFilename,'\\'); | |
233 | + if(ptr && !(strcasecmp(ptr,"\\bin") && strcasecmp(ptr,"\\lib"))) { | |
234 | + *ptr = 0; | |
235 | + } | |
236 | + | |
237 | + strncat(lpFilename,"\\",MAX_PATH); | |
238 | + } | |
231 | 239 | |
232 | 240 | return strdup(lpFilename); |
233 | 241 | } |
... | ... | @@ -274,13 +282,8 @@ static char * build_filename(const char *str, va_list args) { |
274 | 282 | |
275 | 283 | memset(filename,0,szFilename); |
276 | 284 | |
277 | -#ifdef DEBUG | |
278 | - filename[0] = '.'; | |
279 | - filename[1] = '\\'; | |
280 | -#else | |
281 | 285 | DWORD szPath = GetModuleFileName(hModule,filename,szFilename); |
282 | 286 | filename[szPath] = 0; |
283 | -#endif // DEBUG | |
284 | 287 | |
285 | 288 | ptr = strrchr(filename,'\\'); |
286 | 289 | if(ptr) { |
... | ... | @@ -303,14 +306,74 @@ static char * build_filename(const char *str, va_list args) { |
303 | 306 | } |
304 | 307 | |
305 | 308 | char * lib3270_build_data_filename(const char *str, ...) { |
306 | - va_list args; | |
307 | - va_start (args, str); | |
308 | 309 | |
309 | - char *filename = build_filename(str, args); | |
310 | + char *ptr; | |
311 | + lib3270_autoptr(char) instpath = lib3270_get_installation_path(); | |
310 | 312 | |
311 | - va_end (args); | |
313 | + for(ptr = instpath; *ptr; ptr++) { | |
314 | + if(*ptr == '/') { | |
315 | + *ptr = '\\'; | |
316 | + } | |
317 | + } | |
312 | 318 | |
313 | - return filename; | |
319 | + if( *(instpath+strlen(instpath)-1) = '\\') { | |
320 | + instpath[strlen(instpath)-1] = 0; | |
321 | + } | |
322 | + | |
323 | + char relative[MAX_PATH+1]; | |
324 | + memset(relative,0,MAX_PATH); | |
325 | + | |
326 | + { | |
327 | + va_list args; | |
328 | + va_start (args, str); | |
329 | + | |
330 | + while(str) { | |
331 | + | |
332 | + if(str[0] == '\\' || str[0] == '/') { | |
333 | + strncat(relative,str,MAX_PATH); | |
334 | + } else { | |
335 | + strncat(relative,"\\",MAX_PATH); | |
336 | + strncat(relative,str,MAX_PATH); | |
337 | + } | |
338 | + | |
339 | + str = va_arg(args, const char *); | |
340 | + } | |
341 | + | |
342 | + va_end (args); | |
343 | + } | |
344 | + | |
345 | + for(ptr = relative; *ptr; ptr++) { | |
346 | + if(*ptr == '/') { | |
347 | + *ptr = '\\'; | |
348 | + } | |
349 | + } | |
350 | + | |
351 | + char filename[MAX_PATH+1]; | |
352 | + memset(filename,0,MAX_PATH+1); | |
353 | + | |
354 | + // Check instdir | |
355 | + strncpy(filename,instpath,MAX_PATH); | |
356 | + strncat(filename,"\\share",MAX_PATH); | |
357 | + strncat(filename,relative,MAX_PATH); | |
358 | + | |
359 | + if(access(filename,0) == 0) { | |
360 | + return strdup(filename); | |
361 | + } | |
362 | + | |
363 | + strncpy(filename,instpath,MAX_PATH); | |
364 | + strncat(filename,"\\share\\",MAX_PATH); | |
365 | + strncat(filename,LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME),MAX_PATH); | |
366 | + strncat(filename,relative,MAX_PATH); | |
367 | + | |
368 | + if(access(filename,0) == 0) { | |
369 | + return strdup(filename); | |
370 | + } | |
371 | + | |
372 | + // Default behavior. | |
373 | + strncpy(filename,instpath,MAX_PATH); | |
374 | + strncat(filename,relative,MAX_PATH); | |
375 | + | |
376 | + return strdup(filename); | |
314 | 377 | } |
315 | 378 | |
316 | 379 | char * lib3270_build_config_filename(const char *str, ...) { | ... | ... |
win/ci-build.sh
... | ... | @@ -27,7 +27,10 @@ echo "Building lib3270" |
27 | 27 | make clean > $LOGFILE 2>&1 || die "Make clean failure" |
28 | 28 | make all > $LOGFILE 2>&1 || die "Make failure" |
29 | 29 | make DESTDIR=.bin/package install |
30 | -tar --create --xz --file=mingw-lib3270.tar.xz --directory=.bin/package --verbose . | |
30 | + | |
31 | +. ./win/build.conf | |
32 | + | |
33 | +tar --create --xz --file=mingw-lib3270.${TARGET_ARCH}.tar.xz --directory=.bin/package --verbose . | |
31 | 34 | |
32 | 35 | |
33 | 36 | ... | ... |