From 73c4e5130953c36101fa0f5a24a8100ae62340ac Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Mon, 9 Sep 2019 15:10:40 -0300 Subject: [PATCH] Fixing remap file path on windows. --- src/terminal/charset.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/terminal/charset.c b/src/terminal/charset.c index 5b745a2..be749f9 100644 --- a/src/terminal/charset.c +++ b/src/terminal/charset.c @@ -33,6 +33,10 @@ #include #include +#ifdef _WIN32 + #include +#endif // _WIN32 + #define ERROR_DOMAIN g_quark_from_static_string(PACKAGE_NAME) /*--[ Implement ]------------------------------------------------------------------------------------*/ @@ -187,7 +191,29 @@ const gchar * const * system_data_dirs = g_get_system_data_dirs(); #ifdef _WIN32 - #error Implementar. + { + char wc_fn[MAX_PATH]; + + if(GetModuleFileName(NULL, wc_fn, MAX_PATH)) + { + char *p; + + if((p = strrchr(wc_fn, '\\')) != NULL) + *p = '\0'; + + if((p = strrchr(wc_fn, '/')) != NULL) + *p = '\0'; + + gchar *filename = g_build_filename(wc_fn,G_STRINGIFY(PRODUCT_NAME),"remap",name,NULL); + + debug("%s.win32=%s",__FUNCTION__,filename); + if(g_file_test(filename,G_FILE_TEST_IS_REGULAR)) + return filename; + + g_free(filename); + } + + } #endif // _WIN32 for(ix=0;system_data_dirs[ix];ix++) -- libgit2 0.21.2