Fix fish_config in .app

* Export $__fish_bin_dir
* Fix incorrect bundle path in fish.cpp - fish is not in MacOS/ (it should be!)
This commit is contained in:
Aaron Gyes 2016-07-01 03:55:54 -07:00
parent 1fb4cc0e76
commit ca6cda20a3
3 changed files with 8 additions and 8 deletions

View File

@ -1205,7 +1205,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd \"${SRCROOT}\" ;\n# Run build_documentation.sh\n# Do this in a subshell so that we keep going even if it calls exit\nif [ -f lexicon_filter ] ; then\n export INPUT_FILTER=./lexicon_filter\nelse\n echo \"build_documentation:0: warning: lexicon_filter not found, ignoring it\" >&2\nfi\n\n( . \"./build_tools/build_documentation.sh\" \"./Doxyfile.help\" \"./doc_src\" \"$BUILT_PRODUCTS_DIR\" )\n\n# Copy certain files into man1, destined for share/man/man1 (instead of share/fish/man/man1)\n# These copies will fail if the documentation did not build; that's OK\n# We want to create the directory even if the documentation did not build, so that the Xcode build can still succeed\nmanpathdir=\"${BUILT_PRODUCTS_DIR}/pages_for_manpath/man1\"\necho \"Copying pages destined for manpath into $manpathdir\"\nrm -Rf \"$manpathdir\"\nmkdir -p \"$manpathdir\"\nfor manpage in fish.1 set_color.1 fishd.1 fish_indent.1; do\n manpagepath=\"${BUILT_PRODUCTS_DIR}/man/man1/${manpage}\"\n test -f \"$manpagepath\" && cp \"$manpagepath\" \"${BUILT_PRODUCTS_DIR}/pages_for_manpath/man1/\"\ndone\n\n# Always succeed\ntrue\n";
shellScript = "cd \"${SRCROOT}\" ;\n# Run build_documentation.sh\n# Do this in a subshell so that we keep going even if it calls exit\nif [ -f lexicon_filter ] ; then\n export INPUT_FILTER=./lexicon_filter\nelse\n echo \"build_documentation:0: warning: lexicon_filter not found, ignoring it\" >&2\nfi\n\n( . \"./build_tools/build_documentation.sh\" \"./Doxyfile.help\" \"./doc_src\" \"$BUILT_PRODUCTS_DIR\" )\n\n# Copy certain files into man1, destined for share/man/man1 (instead of share/fish/man/man1)\n# These copies will fail if the documentation did not build; that's OK\n# We want to create the directory even if the documentation did not build, so that the Xcode build can still succeed\nmanpathdir=\"${BUILT_PRODUCTS_DIR}/pages_for_manpath/man1\"\necho \"Copying pages destined for manpath into $manpathdir\"\nrm -Rf \"$manpathdir\"\nmkdir -p \"$manpathdir\"\nfor manpage in fish.1 fish_indent.1; do\n manpagepath=\"${BUILT_PRODUCTS_DIR}/man/man1/${manpage}\"\n test -f \"$manpagepath\" && cp \"$manpagepath\" \"${BUILT_PRODUCTS_DIR}/pages_for_manpath/man1/\"\ndone\n\n# Always succeed\ntrue\n";
};
/* End PBXShellScriptBuildPhase section */

View File

@ -4,5 +4,6 @@ function fish_config --description "Launch fish's web based configuration"
if count $argv >/dev/null
set initial_tab $argv[1]
end
set -x __fish_bin_dir $__fish_bin_dir
eval (string escape $__fish_datadir/tools/web_config/webconfig.py) $initial_tab
end

View File

@ -132,19 +132,18 @@ static struct config_paths_t determine_config_directory_paths(const char *argv0)
if (get_realpath(exec_path))
{
#if __APPLE__
/* 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 /Contents/MacOS/fish, case insensitive since HFS+ usually is.
*/
if (! done)
{
const char *suffix = "/Contents/MacOS/fish";
// 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
// /Contents/MacOS/fish, case insensitive since HFS+ usually is.
if (!done) {
const char *suffix = "Contents/Resources/base/bin/fish";
const size_t suffixlen = strlen(suffix);
if (has_suffix(exec_path, suffix, true))
{
/* Looks like we're a bundle. Cut the string at the / prefixing /Contents... and then the rest */
wcstring wide_resolved_path = str2wcstring(exec_path);
wide_resolved_path.resize(exec_path.size() - suffixlen);
wide_resolved_path.append(L"/Contents/Resources/");
wide_resolved_path.append(L"Contents/Resources/base/");
/* Append share, etc, doc */
paths.data = wide_resolved_path + L"share/fish";