@@ -256,7 +256,7 @@ defmodule Mix.Tasks.Format do
256
256
{ formatter_opts_and_subs , _sources } =
257
257
eval_deps_and_subdirectories ( cwd , dot_formatter , formatter_opts , [ dot_formatter ] )
258
258
259
- find_formatter_and_opts_for_file ( file , cwd , formatter_opts_and_subs )
259
+ find_formatter_and_opts_for_file ( Path . expand ( file , cwd ) , formatter_opts_and_subs )
260
260
end
261
261
262
262
@ doc """
@@ -498,14 +498,14 @@ defmodule Mix.Tasks.Format do
498
498
499
499
for file <- files do
500
500
if file == :stdin do
501
- stdin_filename = Keyword . get ( opts , :stdin_filename , "stdin.exs" )
501
+ stdin_filename = Path . expand ( Keyword . get ( opts , :stdin_filename , "stdin.exs" ) , cwd )
502
502
503
503
{ formatter , _opts } =
504
- find_formatter_and_opts_for_file ( stdin_filename , cwd , { formatter_opts , subs } )
504
+ find_formatter_and_opts_for_file ( stdin_filename , { formatter_opts , subs } )
505
505
506
506
{ file , formatter }
507
507
else
508
- { formatter , _opts } = find_formatter_and_opts_for_file ( file , cwd , { formatter_opts , subs } )
508
+ { formatter , _opts } = find_formatter_and_opts_for_file ( file , { formatter_opts , subs } )
509
509
{ file , formatter }
510
510
end
511
511
end
@@ -571,15 +571,15 @@ defmodule Mix.Tasks.Format do
571
571
if plugins != [ ] , do: plugins , else: nil
572
572
end
573
573
574
- defp find_formatter_and_opts_for_file ( file , cwd , formatter_opts_and_subs ) do
575
- formatter_opts = recur_formatter_opts_for_file ( cwd , formatter_opts_and_subs )
574
+ defp find_formatter_and_opts_for_file ( file , formatter_opts_and_subs ) do
575
+ formatter_opts = recur_formatter_opts_for_file ( file , formatter_opts_and_subs )
576
576
{ find_formatter_for_file ( file , formatter_opts ) , formatter_opts }
577
577
end
578
578
579
- defp recur_formatter_opts_for_file ( cwd , { formatter_opts , subs } ) do
579
+ defp recur_formatter_opts_for_file ( file , { formatter_opts , subs } ) do
580
580
Enum . find_value ( subs , formatter_opts , fn { sub , formatter_opts_and_subs } ->
581
- if String . starts_with? ( sub , cwd ) do
582
- recur_formatter_opts_for_file ( sub , formatter_opts_and_subs )
581
+ if String . starts_with? ( file , sub ) do
582
+ recur_formatter_opts_for_file ( file , formatter_opts_and_subs )
583
583
end
584
584
end )
585
585
end
0 commit comments