Commit a576e17df2df3fb9b1a4a9cd747f449f153c0f9a

Authored by Perry Werneck
Committed by GitHub
2 parents f90ad514 688f6c8c
Exists in master and in 1 other branch develop

Merge pull request #41 from PerryWerneck/develop

Better detection of data file path on windows.
src/core/linux/util.c
  1 +/* SPDX-License-Identifier: LGPL-3.0-or-later */
  2 +
1 3 /*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob
5   - * o nome G3270.
6   - *
7   - * Copyright (C) <2008> <Banco do Brasil S.A.>
8   - *
9   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
10   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
11   - * Free Software Foundation.
12   - *
13   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
14   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
15   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
16   - * obter mais detalhes.
  4 + * Copyright (C) 2008 Banco do Brasil S.A.
17 5 *
18   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
19   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
20   - * St, Fifth Floor, Boston, MA 02110-1301 USA
  6 + * This program is free software: you can redistribute it and/or modify
  7 + * it under the terms of the GNU Lesser General Public License as published
  8 + * by the Free Software Foundation, either version 3 of the License, or
  9 + * (at your option) any later version.
21 10 *
22   - * Este programa está nomeado como - e possui - linhas de código.
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
23 15 *
  16 + * You should have received a copy of the GNU Lesser General Public License
  17 + * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18 + */
  19 +
  20 +/*
24 21 * Contatos:
25 22 *
26 23 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
... ...
src/core/windows/util.c
  1 +/* SPDX-License-Identifier: LGPL-3.0-or-later */
  2 +
1 3 /*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob
5   - * o nome G3270.
6   - *
7   - * Copyright (C) <2008> <Banco do Brasil S.A.>
8   - *
9   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
10   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
11   - * Free Software Foundation.
12   - *
13   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
14   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
15   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
16   - * obter mais detalhes.
  4 + * Copyright (C) 2008 Banco do Brasil S.A.
17 5 *
18   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
19   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
20   - * St, Fifth Floor, Boston, MA 02110-1301 USA
  6 + * This program is free software: you can redistribute it and/or modify
  7 + * it under the terms of the GNU Lesser General Public License as published
  8 + * by the Free Software Foundation, either version 3 of the License, or
  9 + * (at your option) any later version.
21 10 *
22   - * Este programa está nomeado como - e possui - linhas de código.
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
23 15 *
  16 + * You should have received a copy of the GNU Lesser General Public License
  17 + * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18 + */
  19 +
  20 +/*
24 21 * Contatos:
25 22 *
26 23 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
... ... @@ -286,8 +283,16 @@ static char * build_filename(const char *str, va_list args) {
286 283 #endif // DEBUG
287 284  
288 285 ptr = strrchr(filename,'\\');
289   - if(ptr)
290   - ptr[1] = 0;
  286 + if(ptr) {
  287 + ptr[0] = 0;
  288 +
  289 + ptr = strrchr(filename,'\\');
  290 + if(ptr && !(strcasecmp(ptr,"\\bin") && strcasecmp(ptr,"\\lib"))) {
  291 + *ptr = 0;
  292 + }
  293 +
  294 + strncat(filename,"\\",szFilename);
  295 + }
291 296  
292 297 while(str) {
293 298 filename = concat(filename,str,&szFilename);
... ...
src/testprogram/testprogram.c
... ... @@ -83,7 +83,7 @@ int main(int argc, char *argv[]) {
83 83 {
84 84 lib3270_autoptr(char) testfilename = lib3270_build_data_filename("test",NULL);
85 85 printf("\n\nFilename: '%s'\n\n", testfilename);
86   -// return 0;
  86 + return 0;
87 87 }
88 88  
89 89 // #pragma GCC diagnostic push
... ...