drun: Removed cached map
This commit is contained in:
parent
2c20a6bda4
commit
c56be00336
15
modes/drun.c
15
modes/drun.c
@ -167,7 +167,7 @@ static char* get_id(char* path) {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void insert_dir(char* app_dir, struct map* cached, struct map* entries) {
|
static void insert_dir(char* app_dir, struct map* entries) {
|
||||||
DIR* dir = opendir(app_dir);
|
DIR* dir = opendir(app_dir);
|
||||||
if(dir == NULL) {
|
if(dir == NULL) {
|
||||||
return;
|
return;
|
||||||
@ -183,12 +183,7 @@ static void insert_dir(char* app_dir, struct map* cached, struct map* entries) {
|
|||||||
struct stat info;
|
struct stat info;
|
||||||
stat(full_path, &info);
|
stat(full_path, &info);
|
||||||
if(S_ISDIR(info.st_mode)) {
|
if(S_ISDIR(info.st_mode)) {
|
||||||
insert_dir(full_path, cached, entries);
|
insert_dir(full_path, entries);
|
||||||
free(id);
|
|
||||||
free(full_path);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(map_contains(cached, id)) {
|
|
||||||
free(id);
|
free(id);
|
||||||
free(full_path);
|
free(full_path);
|
||||||
continue;
|
continue;
|
||||||
@ -234,7 +229,6 @@ void wofi_drun_init(struct mode* this, struct map* config) {
|
|||||||
|
|
||||||
print_command = strcmp(config_get(config, "print_command", "false"), "true") == 0;
|
print_command = strcmp(config_get(config, "print_command", "false"), "true") == 0;
|
||||||
|
|
||||||
struct map* cached = map_init();
|
|
||||||
struct map* entries = map_init();
|
struct map* entries = map_init();
|
||||||
struct wl_list* cache = wofi_read_cache(mode);
|
struct wl_list* cache = wofi_read_cache(mode);
|
||||||
|
|
||||||
@ -258,7 +252,7 @@ void wofi_drun_init(struct mode* this, struct map* config) {
|
|||||||
|
|
||||||
char* id = get_id(node->line);
|
char* id = get_id(node->line);
|
||||||
|
|
||||||
map_put(cached, id, "true");
|
map_put(entries, id, "true");
|
||||||
|
|
||||||
free(id);
|
free(id);
|
||||||
|
|
||||||
@ -296,11 +290,10 @@ void wofi_drun_init(struct mode* this, struct map* config) {
|
|||||||
char* str = strtok_r(dirs, ":", &save_ptr);
|
char* str = strtok_r(dirs, ":", &save_ptr);
|
||||||
do {
|
do {
|
||||||
char* app_dir = utils_concat(2, str, "/applications");
|
char* app_dir = utils_concat(2, str, "/applications");
|
||||||
insert_dir(app_dir, cached, entries);
|
insert_dir(app_dir, entries);
|
||||||
free(app_dir);
|
free(app_dir);
|
||||||
} while((str = strtok_r(NULL, ":", &save_ptr)) != NULL);
|
} while((str = strtok_r(NULL, ":", &save_ptr)) != NULL);
|
||||||
free(dirs);
|
free(dirs);
|
||||||
map_free(cached);
|
|
||||||
map_free(entries);
|
map_free(entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user