This commit is contained in:
+2
-4
@@ -50,7 +50,7 @@ const char *file_completion(const char *path) {
|
||||
if (last_slash) {
|
||||
dir_len = last_slash - path + 1; // length of dir_path
|
||||
strncpy(directory, path, dir_len);
|
||||
predict_len = strlen(path) - dir_len - 1;
|
||||
predict_len = strlen(path) - dir_len;
|
||||
strncpy(predict, last_slash + 1, predict_len);
|
||||
directory[dir_len] = '\0';
|
||||
predict[predict_len] = '\0';
|
||||
@@ -73,9 +73,7 @@ const char *file_completion(const char *path) {
|
||||
strcat(full_path, "/"); // add slash for directories
|
||||
}
|
||||
closedir(dir);
|
||||
dir = NULL;
|
||||
free(entry);
|
||||
|
||||
|
||||
return strdup(full_path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user