LPS-50926 folder may not exist

cc/ @adolfopa 

Note that a commit is missing from this forward port. That commit fixed an error in incremental-search-hook, not available in master.