Commit 1a6870b3 authored by Bruno Pinto's avatar Bruno Pinto

Merge pull request #82 from theonewolf/fix-duplicating-function-path

parents 241e2a40 605028a7
......@@ -2,15 +2,22 @@
# Helper functions
###
function _test_dir
set -l path $argv[1]
set -l paths $argv[2]
return (test -d $path; and not contains $path $paths)
end
function _fish_add_plugin
set -l plugin $argv[1]
set -l plugin_path "plugins/$plugin"
if test -d $fish_path/$plugin_path
if _test_dir $fish_path/$plugin_path $fish_function_path
set fish_function_path $fish_path/$plugin_path $fish_function_path
end
if test -d $fish_custom/$plugin_path
if _test_dir $fish_custom/$plugin_path $fish_function_path
set fish_function_path $fish_custom/$plugin_path $fish_function_path
end
end
......@@ -42,11 +49,11 @@ function _fish_source_plugin_load_file
end
function _fish_load_theme
if test -d $fish_path/themes/$fish_theme
if _test_dir $fish_path/themes/$fish_theme $fish_function_path
set fish_function_path $fish_path/themes/$fish_theme $fish_function_path
end
if test -d $fish_custom/themes/$fish_theme
if _test_dir $fish_custom/themes/$fish_theme $fish_function_path
set fish_function_path $fish_custom/themes/$fish_theme $fish_function_path
end
end
......@@ -66,7 +73,9 @@ set user_function_path $fish_function_path[1]
set -e fish_function_path[1]
# Add all functions
set fish_function_path $fish_path/functions/ $fish_function_path
if not contains $fish_path/functions/ $fish_function_path
set fish_function_path $fish_path/functions/ $fish_function_path
end
# Add all defined plugins
for plugin in $fish_plugins
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment