@@ -256,7 +256,7 @@ defmodule Mix.Tasks.Format do
256256 { formatter_opts_and_subs , _sources } =
257257 eval_deps_and_subdirectories ( cwd , dot_formatter , formatter_opts , [ dot_formatter ] )
258258
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 )
260260 end
261261
262262 @ doc """
@@ -498,14 +498,14 @@ defmodule Mix.Tasks.Format do
498498
499499 for file <- files do
500500 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 )
502502
503503 { 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 } )
505505
506506 { file , formatter }
507507 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 } )
509509 { file , formatter }
510510 end
511511 end
@@ -571,15 +571,15 @@ defmodule Mix.Tasks.Format do
571571 if plugins != [ ] , do: plugins , else: nil
572572 end
573573
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 )
576576 { find_formatter_for_file ( file , formatter_opts ) , formatter_opts }
577577 end
578578
579- defp recur_formatter_opts_for_file ( cwd , { formatter_opts , subs } ) do
579+ defp recur_formatter_opts_for_file ( file , { formatter_opts , subs } ) do
580580 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 )
583583 end
584584 end )
585585 end
0 commit comments