mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
Merge pull request #741 from LemonBoy/complete
Complete filenames ending with a slash
This commit is contained in:
commit
be70fa5eb7
@ -321,6 +321,10 @@ GList *filename_complete(const char *path, const char *default_path)
|
|||||||
|
|
||||||
g_return_val_if_fail(path != NULL, NULL);
|
g_return_val_if_fail(path != NULL, NULL);
|
||||||
|
|
||||||
|
if (path[0] == '\0') {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
list = NULL;
|
list = NULL;
|
||||||
|
|
||||||
/* get directory part of the path - expand ~/ */
|
/* get directory part of the path - expand ~/ */
|
||||||
@ -350,7 +354,14 @@ GList *filename_complete(const char *path, const char *default_path)
|
|||||||
g_free_and_null(dir);
|
g_free_and_null(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
len = strlen(path);
|
||||||
|
/* g_path_get_basename() returns the component before the last slash if
|
||||||
|
* the path ends with a directory separator, that's not what we want */
|
||||||
|
if (len > 0 && path[len - 1] == G_DIR_SEPARATOR) {
|
||||||
|
basename = g_strdup("");
|
||||||
|
} else {
|
||||||
basename = g_path_get_basename(path);
|
basename = g_path_get_basename(path);
|
||||||
|
}
|
||||||
len = strlen(basename);
|
len = strlen(basename);
|
||||||
|
|
||||||
/* add all files in directory to completion list */
|
/* add all files in directory to completion list */
|
||||||
|
Loading…
Reference in New Issue
Block a user