diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/shortcuts/shortcuts.h | 3 | ||||
-rw-r--r-- | apps/plugins/shortcuts/shortcuts_append.c | 4 | ||||
-rw-r--r-- | apps/plugins/shortcuts/shortcuts_common.c | 32 | ||||
-rw-r--r-- | apps/plugins/shortcuts/shortcuts_view.c | 4 |
4 files changed, 4 insertions, 39 deletions
diff --git a/apps/plugins/shortcuts/shortcuts.h b/apps/plugins/shortcuts/shortcuts.h index 6ccb320a36..34f200d193 100644 --- a/apps/plugins/shortcuts/shortcuts.h +++ b/apps/plugins/shortcuts/shortcuts.h | |||
@@ -79,9 +79,6 @@ bool remove_entry(sc_file_t *file, int entry_idx); | |||
79 | /* Checks whether the index is a valid one for the file. */ | 79 | /* Checks whether the index is a valid one for the file. */ |
80 | bool is_valid_index(sc_file_t *file, int entry_idx); | 80 | bool is_valid_index(sc_file_t *file, int entry_idx); |
81 | 81 | ||
82 | bool file_exists(char *filename); /* Does the specified file exist? */ | ||
83 | bool dir_exists(char *path); /* Does the specified dir exist? */ | ||
84 | |||
85 | 82 | ||
86 | #ifdef SC_DEBUG | 83 | #ifdef SC_DEBUG |
87 | void print_file(sc_file_t *file); | 84 | void print_file(sc_file_t *file); |
diff --git a/apps/plugins/shortcuts/shortcuts_append.c b/apps/plugins/shortcuts/shortcuts_append.c index bc287234dd..afd03929ae 100644 --- a/apps/plugins/shortcuts/shortcuts_append.c +++ b/apps/plugins/shortcuts/shortcuts_append.c | |||
@@ -70,9 +70,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* void_parameter) | |||
70 | * if it's a dir and then file (not vice versa) since | 70 | * if it's a dir and then file (not vice versa) since |
71 | * open() can also open a dir */ | 71 | * open() can also open a dir */ |
72 | found = true; | 72 | found = true; |
73 | if (dir_exists(parameter)) { | 73 | if (rb->dir_exists(parameter)) { |
74 | its_a_dir = true; | 74 | its_a_dir = true; |
75 | } else if (file_exists(parameter)) { | 75 | } else if (rb->file_exists(parameter)) { |
76 | its_a_dir = false; | 76 | its_a_dir = false; |
77 | } else { | 77 | } else { |
78 | found = false; | 78 | found = false; |
diff --git a/apps/plugins/shortcuts/shortcuts_common.c b/apps/plugins/shortcuts/shortcuts_common.c index 4a097f0a0d..91e3084e10 100644 --- a/apps/plugins/shortcuts/shortcuts_common.c +++ b/apps/plugins/shortcuts/shortcuts_common.c | |||
@@ -360,35 +360,3 @@ void write_entry_to_file(int fd, sc_entry_t *entry) | |||
360 | } | 360 | } |
361 | rb->fdprintf(fd, "\n"); | 361 | rb->fdprintf(fd, "\n"); |
362 | } | 362 | } |
363 | |||
364 | |||
365 | bool file_exists(char *filename) | ||
366 | { | ||
367 | int fd = rb->open(filename, O_RDONLY); | ||
368 | bool retval; | ||
369 | if (fd >= 0) { | ||
370 | rb->close(fd); | ||
371 | retval = true; | ||
372 | } else { | ||
373 | retval = false; | ||
374 | } | ||
375 | DEBUGF("Checked existence of the file '%s': %s\n", | ||
376 | filename, (retval ? "found" : "NOT FOUND")); | ||
377 | return retval; | ||
378 | } | ||
379 | |||
380 | |||
381 | bool dir_exists(char *path) | ||
382 | { | ||
383 | DIR* d = rb->opendir(path); | ||
384 | bool retval; | ||
385 | if (d != NULL) { | ||
386 | rb->closedir(d); | ||
387 | retval = true; | ||
388 | } else { | ||
389 | retval = false; | ||
390 | } | ||
391 | DEBUGF("Checked existence of the dir '%s': %s\n", | ||
392 | path, (retval ? "found" : "NOT FOUND")); | ||
393 | return retval; | ||
394 | } | ||
diff --git a/apps/plugins/shortcuts/shortcuts_view.c b/apps/plugins/shortcuts/shortcuts_view.c index f61177f37a..4ef1bbc816 100644 --- a/apps/plugins/shortcuts/shortcuts_view.c +++ b/apps/plugins/shortcuts/shortcuts_view.c | |||
@@ -166,10 +166,10 @@ bool goto_entry(char *file_or_dir) | |||
166 | char *what; | 166 | char *what; |
167 | if (is_dir) { | 167 | if (is_dir) { |
168 | what = "Directory"; | 168 | what = "Directory"; |
169 | exists = dir_exists(file_or_dir); | 169 | exists = rb->dir_exists(file_or_dir); |
170 | } else { | 170 | } else { |
171 | what = "File"; | 171 | what = "File"; |
172 | exists = file_exists(file_or_dir); | 172 | exists = rb->file_exists(file_or_dir); |
173 | } | 173 | } |
174 | 174 | ||
175 | if (!exists) { | 175 | if (!exists) { |