Skip to content

Commit 77755f9

Browse files
author
José Valim
committed
Use the new Path.expand on mix
1 parent cb1b4c5 commit 77755f9

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

lib/mix/lib/mix/local.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ defmodule Mix.Local do
77
The path for local tasks.
88
"""
99
def tasks_path do
10-
Path.join Mix.Utils.user_home, ".mix/tasks"
10+
Path.join Mix.Utils.mix_home, "tasks"
1111
end
1212

1313
@doc """

lib/mix/lib/mix/utils.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ defmodule Mix.Utils do
1515
"""
1616

1717
@doc """
18-
Gets the user home attempting to consider OS system diferences.
18+
Gets the mix home. It defaults to `~/.mix` unless the
19+
MIX_HOME environment variable is set.
1920
"""
20-
def user_home do
21-
System.get_env("MIX_HOME") || System.get_env("HOME") || System.get_env("USERPROFILE") ||
22-
raise Mix.Error, message: "Nor MIX_HOME, HOME or USERPROFILE env variables were set"
21+
def mix_home do
22+
System.get_env("MIX_HOME") || Path.expand("~/.mix")
2323
end
2424

2525
@doc """
@@ -285,7 +285,7 @@ defmodule Mix.Utils do
285285

286286
@doc """
287287
Takes a command and converts it to a module name format.
288-
288+
289289
## Examples
290290
291291
command_to_module_name("compile.elixir")

lib/mix/test/mix/tasks/local_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ defmodule Mix.Tasks.LocalTest do
55

66
test "manage local tasks" do
77
File.rm_rf! tmp_path("userhome")
8-
System.put_env "MIX_HOME", tmp_path("userhome")
8+
System.put_env "MIX_HOME", tmp_path("userhome/.mix")
99

1010
# Install it!
1111
self <- { :mix_shell_input, :yes?, true }

lib/mix/test/test_helper.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ defmodule MixTest.Case do
5757
Mix.Task.clear
5858
Mix.Shell.Process.flush
5959
Mix.Deps.Converger.clear_cache
60-
System.put_env("MIX_HOME", tmp_path)
60+
System.put_env("MIX_HOME", tmp_path(".mix"))
6161
del_tmp_paths
6262
end
6363

0 commit comments

Comments
 (0)