Report exec_path and the final config paths via debug()

I was surprised fish_indent was running from /usr/local/bin
instead of the git checkout when I ran ./fish
after building fish there. This was more easily noticable after my last
commit. I added some debug lines which probably fish could have been
doing already when looking into that.

This is a pretty major thing during fish initialization, commit it for
everyone.
This commit is contained in:
Aaron Gyes 2016-09-23 08:45:03 -07:00
parent 4c34ba9959
commit 503edf2d49

View file

@ -91,6 +91,8 @@ static std::string get_executable_path(const char *argv0) {
#if __APPLE__ #if __APPLE__
// On OS X use it's proprietary API to get the path to the executable. // On OS X use it's proprietary API to get the path to the executable.
// This is basically grabbing exec_path after argc, argv, envp, ...: for us
// https://opensource.apple.com/source/adv_cmds/adv_cmds-163/ps/print.c
uint32_t buffSize = sizeof buff; uint32_t buffSize = sizeof buff;
if (_NSGetExecutablePath(buff, &buffSize) == 0) return std::string(buff); if (_NSGetExecutablePath(buff, &buffSize) == 0) return std::string(buff);
#else #else
@ -121,6 +123,7 @@ static struct config_paths_t determine_config_directory_paths(const char *argv0)
std::string exec_path = get_executable_path(argv0); std::string exec_path = get_executable_path(argv0);
if (get_realpath(exec_path)) { if (get_realpath(exec_path)) {
#if __APPLE__ #if __APPLE__
debug(2, L"exec_path: '%s'", exec_path.c_str());
// On OS X, maybe we're an app bundle, and should use the bundle's files. Since we don't // On OS X, maybe we're an app bundle, and should use the bundle's files. Since we don't
// link CF, use this lame approach to test it: see if the resolved path ends with // link CF, use this lame approach to test it: see if the resolved path ends with
@ -186,6 +189,7 @@ static struct config_paths_t determine_config_directory_paths(const char *argv0)
paths.bin = L"" BINDIR; paths.bin = L"" BINDIR;
} }
debug(2, "determine_config_directory_paths() results:\npaths.data: %ls\npaths.sysconf: %ls\npaths.doc: %ls\npaths.bin: %ls", paths.data.c_str(), paths.sysconf.c_str(), paths.doc.c_str(), paths.bin.c_str());
return paths; return paths;
} }