1
0
Fork 0
mirror of https://github.com/Raymo111/i3lock-color.git synced 2024-11-11 13:50:52 -05:00

Treat anything that's not a directory as a file

This commit is contained in:
Martin Dørum 2019-05-25 23:33:05 +02:00
parent 966b2b1b50
commit 7b110ed2bc

View file

@ -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 */