Skip to content

Commit 7b3bbe3

Browse files
author
José Valim
committed
Another attempt at cwd handling
1 parent ade2c25 commit 7b3bbe3

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

lib/elixir/lib/file.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,7 @@ defmodule File do
884884
"""
885885
def cwd() do
886886
case F.get_cwd do
887-
{ :ok, base } when is_binary(base) -> { :ok, base }
888-
{ :ok, base } -> { :ok, to_string(base) }
887+
{ :ok, base } -> { :ok, String.from_char_list!(base) }
889888
{ :error, _ } = error -> error
890889
end
891890
end

lib/elixir/lib/path.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ defmodule Path do
243243
"""
244244
def relative_to_cwd(path) do
245245
case :file.get_cwd do
246-
{ :ok, base } when is_binary(base) -> relative_to(path, to_char_list(base))
247246
{ :ok, base } -> relative_to(path, base)
248247
_ -> path
249248
end

lib/elixir/lib/system.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ defmodule System do
9393
"""
9494
def cwd do
9595
case :file.get_cwd do
96-
{ :ok, base } when is_binary(base) -> base
9796
{ :ok, base } -> String.from_char_list!(base)
9897
_ -> nil
9998
end
@@ -153,9 +152,9 @@ defmodule System do
153152
"""
154153
def tmp_dir do
155154
write_env_tmp_dir('TMPDIR') ||
156-
write_env_tmp_dir('TEMP') ||
157-
write_env_tmp_dir('TMP') ||
158-
write_tmp_dir("/tmp") ||
155+
write_env_tmp_dir('TEMP') ||
156+
write_env_tmp_dir('TMP') ||
157+
write_tmp_dir('/tmp') ||
159158
((cwd = cwd()) && write_tmp_dir(cwd))
160159
end
161160

@@ -182,7 +181,8 @@ defmodule System do
182181
case { elem(info, type_index), elem(info, access_index) } do
183182
{ :directory, access } when access in [:read_write, :write] ->
184183
String.from_char_list!(dir)
185-
_ -> nil
184+
_ ->
185+
nil
186186
end
187187
{ :error, _ } -> nil
188188
end

0 commit comments

Comments
 (0)