commit 7b110ed2bc6294d9253bc57825e0005f35b9226c
parent 966b2b1b503ad41818e72990235323649fd7da99
Author: Martin Dørum <martid0311@gmail.com>
Date: Sat, 25 May 2019 23:33:05 +0200
Treat anything that's not a directory as a file
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/i3lock.c b/i3lock.c
@@ -262,10 +262,10 @@ bool bar_reversed = false;
/*
* Checks if the given path leads to an actual file or something else, e.g. a directory
*/
-int is_regular_file(const char *path) {
+int is_directory(const char *path) {
struct stat path_stat;
stat(path, &path_stat);
- return S_ISREG(path_stat.st_mode);
+ return !S_ISDIR(path_stat.st_mode);
}
/*
@@ -1956,7 +1956,7 @@ int main(int argc, char *argv[]) {
init_colors_once();
if (image_path != NULL) {
- if (is_regular_file(image_path)) {
+ if (!is_directory(image_path)) {
img = load_image(image_path);
} else {
/* Path to a directory is provided -> use slideshow mode */