diff options
author | Karl Berry <karl@freefriends.org> | 2020-11-06 21:53:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-11-06 21:53:13 +0000 |
commit | dfba327ead142f0b6bc2d4cc326dc5accd491b0a (patch) | |
tree | bf11614cdb9196d5ee2ee8188932fc6b1348338d /Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm | |
parent | c94a02c2dfcdf9763957eefe2f80c61b25e4c96d (diff) |
latexindent (6nov20)
git-svn-id: svn://tug.org/texlive/trunk@56869 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm')
-rw-r--r-- | Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm index addcdaf3f17..e46eccf3809 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm @@ -20,6 +20,7 @@ use LatexIndent::Switches qw/%switches $is_m_switch_active $is_t_switch_active $ use YAML::Tiny; # interpret defaultSettings.yaml and other potential settings files use File::Basename; # to get the filename and directory path use File::HomeDir; +use Cwd; use Log::Log4perl qw(get_logger :levels); use Exporter qw/import/; our @EXPORT_OK = qw/yaml_read_settings yaml_modify_line_breaks_settings yaml_get_indentation_settings_for_this_object yaml_poly_switch_get_every_or_custom_value yaml_get_indentation_information yaml_get_object_attribute_for_indentation_settings yaml_alignment_at_ampersand_settings yaml_get_textwrap_removeparagraphline_breaks %masterSettings yaml_get_columns/; @@ -169,6 +170,7 @@ sub yaml_read_settings{ push(@localSettings,$switches{readLocalSettings}) if($switches{readLocalSettings}); } + my $workingFileLocation = dirname (${$self}{fileName}); # add local settings to the paths, if appropriate foreach (@localSettings) { # check for an extension (.yaml) @@ -180,8 +182,14 @@ sub yaml_read_settings{ # if the -l switch is called on its own, or else with + # and latexindent.pl is called from a different directory, then # we need to account for this - if($_ eq "localSettings.yaml"){ - $_ = dirname (${$self}{fileName})."/".$_; + if($_ eq "localSettings.yaml" ){ + # check for existence in the directory of the file. + if ( (-e $workingFileLocation."/".$_) ) { + $_ = $workingFileLocation."/".$_; + # otherwise we fallback to the current directory + } elsif( (-e cwd()."/".$_) ){ + $_ = cwd()."/".$_; + } } # check for existence and non-emptiness |