Added _getFile and _isSingleFileMatchingRegex

@keertip 

Also fixed a dormant error in _getFolder and made it shorter.
This is the suspected error mentioned in the PR description: we're checking `resource.project`, but then return `resource.parent`.