mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 16:16:01 +01:00
Simplify code a bit
This commit is contained in:
parent
6a676cc5b5
commit
05c44474d1
1 changed files with 1 additions and 7 deletions
|
@ -576,13 +576,7 @@ get_formatted_filename(zathura_t* zathura, const char* file_path, bool statusbar
|
||||||
&& g_str_has_prefix(file_path, home)
|
&& g_str_has_prefix(file_path, home)
|
||||||
&& (!file_path[home_len] || file_path[home_len] == '/')) {
|
&& (!file_path[home_len] || file_path[home_len] == '/')) {
|
||||||
|
|
||||||
size_t remaining_len = file_path_len - home_len;
|
return g_strdup_printf("~%s", &file_path[home_len]);
|
||||||
|
|
||||||
GString* remaining_path = g_string_new_len(&file_path[home_len], remaining_len);
|
|
||||||
char* tilde_path = g_strdup_printf("~%s", remaining_path->str);
|
|
||||||
g_string_free(remaining_path, true);
|
|
||||||
|
|
||||||
return tilde_path;
|
|
||||||
} else {
|
} else {
|
||||||
return g_strdup(file_path);
|
return g_strdup(file_path);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue