WrapEarnPass left a comment (geany/geany#4609)
msgwindow.c@1000 seems to be the place to fix this, if desired.
```
if (dir == NULL)
utf8_dir = utils_get_utf8_from_locale(build_info.dir);
else
utf8_dir = g_strdup(dir);
g_return_if_fail(utf8_dir != NULL);
trimmed_string = g_strdup(string);
g_strchug(trimmed_string); /* remove possible leading whitespace */
ft = filetypes[build_info.file_type_id];
```
It only has one place to look for a directory if the passed directory is null.
I would replace this with
```
if(dir){
utf8_dir = g_strdup(dir);
ft=filetypes[build_info.file_type_id];
}else if(build_info.dir){
utf8_dir = utils_get_utf8_from_locale(build_info.dir);
ft=filetypes[build_info.file_type_id];
}else if(document_get_current()){
//use the currrent document to provide build_info
GeanyDocument* doc=document_get_current();
gchar* doc_path =g_path_get_dirname(doc->real_path);
utf8_dir = utils_get_utf8_from_locale(doc_path);
g_free(doc_path);
ft = doc->file_type;
}
g_return_if_fail(utf8_dir != NULL);
trimmed_string = g_strdup(string);
g_strchug(trimmed_string); // remove possible leading whitespace
```
This is similar to existing logic at msgwindow.c@913
```
/* we have no filename in the error message, so take the
current one and hope it's correct */
GeanyDocument *doc = document_get_current();
if (doc != NULL)
*filename = g_strdup(doc->file_name);
```
Testing seems to fix the issue with Compiler failing to jump with an open
document but no existing build_info, eliminating the need to change or expose
any other properties from Build.
--
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/4609#issuecomment-4844300488
You are receiving this because you are subscribed to this thread.
Message ID: <geany/geany/issues/4609/[email protected]>