Search for .cabal file from target file directory

Currently search for .cabal file is done from current directory
which requires that hdevtools is run from package directory or
it's subdirectory which is not always easy to achieve when
hdevtools is run from inside editor.
This fix changes search logic so that .cabal file is searched
starting from target file's directory (for commands that have
target file) or from current directory for other commands.