krzysztofzablocki / LinkedConsole

Clickable links in your Xcode console, so you never wonder which class logged the message.
http://merowing.info
MIT License
931 stars 63 forks source link

Search parent directories if the file is not found in the current workspace. #14

Closed ewanmellor closed 8 years ago

ewanmellor commented 8 years ago

If the file that we're looking for is not found in the current workspace, search the parent directory. This will find the file if it is in a separate repo nearby to the current project. This is easier than parsing the project's header and framework search paths, but hopefully will find the file in most cases.

This recursion stops if we have searched two levels up, or if we've reached the user's home directory. This is to avoid performing searches that are too costly.

This PR also changes runShellCommand so that it doesn't use the shell. This fixes a potentially serious security hole in the handling of the shell arguments, because the workspacePath and fileName were not escaped and were just passed to the shell verbatim. To avoid using the shell at all, we can use -quit on the find command line, so there's no need for the pipe to head -n 1.

This PR also adds -L to the find command line. This means that find will follow any symbolic links when looking for files. If the user has repos that are symlinked into their workspace, this means that we'll find them now.

krzysztofzablocki commented 8 years ago

I like it, great work @ewanmellor :+1: