mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-27 04:32:55 +00:00
fix if_existing bugs
- it was returning reverse results when searching strings in file - if didn't detect that files didn't exist when searching for strings
This commit is contained in:
parent
3cca68ed3e
commit
19b9441704
@ -594,17 +594,14 @@ static int check_contains(char *f, char *s)
|
||||
int if_existing_iftest(struct text_object *obj)
|
||||
{
|
||||
char *spc;
|
||||
int result = 1;
|
||||
int result;
|
||||
|
||||
spc = strchr(obj->data.s, ' ');
|
||||
if (!spc && access(obj->data.s, F_OK)) {
|
||||
result = 0;
|
||||
} else if (spc) {
|
||||
*spc = '\0';
|
||||
if (check_contains(obj->data.s, spc + 1))
|
||||
result = 0;
|
||||
*spc = ' ';
|
||||
}
|
||||
if(spc != NULL) *spc = 0;
|
||||
if (access(obj->data.s, F_OK) == 0) {
|
||||
if(spc == NULL || check_contains(obj->data.s, spc + 1)) result = 1;
|
||||
} else result = 0;
|
||||
if(spc != NULL) *spc = ' ';
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user