slamhound icon indicating copy to clipboard operation
slamhound copied to clipboard

Slamhound only works from the root directory

Open phillord opened this issue 12 years ago • 1 comments

Slamhound only seems to work from the root directory of a project with a fully qualified file name. So consider this example:

~/scratch $ lein new slamhound-test
Generating a project called slamhound-test based on the 'default' template.  
To see other templates (app, lein plugin, etc), try `lein help new`.
~/scratch $ cd slamhound-test/src/slamhound_test/
~/scratch/slamhound-test/src/slamhound_test $ ls
core.clj
~/scratch/slamhound-test/src/slamhound_test $ lein slamhound core.clj
~/scratch/slamhound-test/src/slamhound_test $ cd ..
~/scratch/slamhound-test/src $ cd ..
~/scratch/slamhound-test $ lein slamhound src/slamhound_test/core.clj

The first use of slamhound does nothing at all (although it appears to exit normally). I think that it should either update the ns form, and at least crash when used like so.

phillord avatar Dec 02 '13 07:12 phillord

This is due to Leiningen changing directories to the project root before launching project code. However, it sets the leiningien.original.pwd property to the original directory, so we should look for relative path names based on that property if it's present.

technomancy avatar Dec 02 '13 17:12 technomancy