From ca6cda20a36e91a764c17b218b07a8970d813663 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Fri, 1 Jul 2016 03:55:54 -0700 Subject: [PATCH] Fix fish_config in .app * Export $__fish_bin_dir * Fix incorrect bundle path in fish.cpp - fish is not in MacOS/ (it should be!) --- fish.xcodeproj/project.pbxproj | 2 +- share/functions/fish_config.fish | 1 + src/fish.cpp | 13 ++++++------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fish.xcodeproj/project.pbxproj b/fish.xcodeproj/project.pbxproj index 9c7b3f8e4..1f152b084 100644 --- a/fish.xcodeproj/project.pbxproj +++ b/fish.xcodeproj/project.pbxproj @@ -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 */ diff --git a/share/functions/fish_config.fish b/share/functions/fish_config.fish index 1ca305308..9bcac866e 100644 --- a/share/functions/fish_config.fish +++ b/share/functions/fish_config.fish @@ -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 diff --git a/src/fish.cpp b/src/fish.cpp index 9b73342e2..a97def252 100644 --- a/src/fish.cpp +++ b/src/fish.cpp @@ -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";