Commit 3c277bef361b6597dc528cd4f9e962eed2fe9a9e
1 parent
5933730c
Exists in
master
and in
5 other branches
Facilitando debug em windows: Incluindo deteccao do diretorio de fontes com base no path atual
Showing
1 changed file
with
29 additions
and
3 deletions
Show diff stats
src/pw3270/common/config.c
| ... | ... | @@ -620,7 +620,6 @@ gchar * filename_from_va(const gchar *first_element, va_list args) |
| 620 | 620 | } |
| 621 | 621 | #endif // HAVE_WIN_REGISTRY |
| 622 | 622 | |
| 623 | - | |
| 624 | 623 | if(!result) |
| 625 | 624 | { |
| 626 | 625 | // Search for application folder on system data dirs |
| ... | ... | @@ -643,10 +642,37 @@ gchar * filename_from_va(const gchar *first_element, va_list args) |
| 643 | 642 | } |
| 644 | 643 | |
| 645 | 644 | } |
| 645 | + | |
| 646 | +#ifdef DEBUG | |
| 647 | + if(!result) | |
| 648 | + { | |
| 649 | + int f; | |
| 650 | + gchar *dir = g_get_current_dir(); | |
| 651 | + | |
| 652 | + for(f=0;f<2 && dir;f++) | |
| 653 | + { | |
| 654 | + gchar *ptr = dir; | |
| 655 | + dir = g_path_get_dirname(ptr); | |
| 656 | + g_free(ptr); | |
| 657 | + } | |
| 658 | + | |
| 659 | + if(dir) | |
| 660 | + { | |
| 661 | + gchar *name = g_build_filename(dir,"ui",NULL); | |
| 662 | + if(g_file_test(name,G_FILE_TEST_IS_DIR)) | |
| 663 | + result = g_string_new(dir); | |
| 664 | + g_free(name); | |
| 665 | + g_free(dir); | |
| 666 | + } | |
| 667 | + | |
| 668 | + } | |
| 669 | +#endif // DEBUG | |
| 646 | 670 | |
| 647 | 671 | if(!result) |
| 648 | - { | |
| 649 | - result = g_string_new(g_get_current_dir()); | |
| 672 | + { | |
| 673 | + gchar *dir = g_get_current_dir(); | |
| 674 | + result = g_string_new(dir); | |
| 675 | + g_free(dir); | |
| 650 | 676 | g_warning("Unable to find application datadir, using %s",result->str); |
| 651 | 677 | } |
| 652 | 678 | ... | ... |