what you actually want is find ( or even better if ycp have like ruby beside find also method like any?, all? etc.), so it can look like
```
string target_dir = find(string directory, systemd_dirs, {
  FileUtils::Exists(sformat("%1/%2.service", directory, name));
}

if (target_dir != nil )
...
```