The feature of expanding ~ belongs to bash, not Linux itself. 

On 7 May 2016 3:27:18 AM AEST, Onorio Catenacci <catena...@ieee.org> wrote:
>Oh--that's good to know José.  I had just assumed that Unix wouldn't
>have
>that issue since Windows seems to be such a fertile hunting ground for
>odd
>behaviors.
>
>On Fri, May 6, 2016 at 12:50 PM, José Valim
><jose.va...@plataformatec.com.br
>> wrote:
>
>> The behavior you described is also the behavior on UNIX. You must
>expand
>> paths with Path.expand if you want entries like "~" to be expanded.
>>
>>
>> On Friday, May 6, 2016, Onorio Catenacci <catena...@gmail.com> wrote:
>>
>>> And, of course, after I post that, I spot System.user_home/0. So
>this
>>> would be even better yet:
>>>
>>> home_dir = System.user_home
>>>
>>> I guess the upshot is that you can't rely on "~" on Windows. I don't
>mind
>>> that it doesn't work; it's the fact that it doesn't give any
>indication
>>> that it won't work that bothers me.
>>>
>>> --
>>> Onorio
>>>
>>>
>>> On Friday, May 6, 2016 at 12:15:48 PM UTC-4, Onorio Catenacci wrote:
>>>>
>>>> Quick Pro Tip:
>>>>
>>>> Apparently on Windows, the "~" to refer to the home directory
>doesn't
>>>> work correctly. And it doesn't throw any sort of error to let you
>know that
>>>> it doesn't work correctly so it will simply silently fail. Here's a
>bit of
>>>> code I just hacked together to work around this issue (FWIW):
>>>>
>>>> home_dir =
>>>>   case (:os.type()) do
>>>>     {:win32,_} -> System.get_env("UserProfile")
>>>>     {:unix,_} -> "~"
>>>>   end
>>>>
>>>>
>>>> You can see the issue in this way:
>>>>
>>>> 1.) Fire up iex
>>>>
>>>> 2.) iex(1)> File.mkdir_p!("~/bogus")
>>>> :ok
>>>>
>>>> 3.) PS C:\Users\ocatenacci> dir b*
>>>>
>>>>
>>>>     Directory: C:\Users\ocatenacci
>>>>
>>>>
>>>> Mode                LastWriteTime         Length Name
>>>> ----                -------------         ------ ----
>>>> d-----        7/16/2015   3:14 PM                Babou
>>>> -a----       11/20/2015   3:39 PM           7606 boot.bat
>>>>
>>>> 4.) iex(2)> home = System.get_env("UserProfile")
>>>> "C:\\Users\\ocatenacci"
>>>> iex(3)> File.mkdir_p!("#{home}/bogus")
>>>> :ok
>>>>
>>>> 5.) PS C:\Users\ocatenacci> dir b*
>>>>
>>>>
>>>>     Directory: C:\Users\ocatenacci
>>>>
>>>>
>>>> Mode                LastWriteTime         Length Name
>>>> ----                -------------         ------ ----
>>>> d-----        7/16/2015   3:14 PM                Babou
>>>> d-----         5/6/2016  12:12 PM                bogus
>>>> -a----       11/20/2015   3:39 PM           7606 boot.bat
>>>>
>>>>
>>>> I hadn't actually checked this on Unix but I'd be shocked were it a
>>>> problem.  The only real annoyance to this is that no error is
>thrown--the
>>>> directory simply isn't created.
>>>> I can file an issue if it's wanted.  Just wanted to make sure those
>few
>>>> of us who use windows are aware of the issue.
>>>>
>>>> --
>>>> Onorio
>>>>
>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>Groups
>>> "elixir-lang-core" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>send an
>>> email to elixir-lang-core+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>>
>https://groups.google.com/d/msgid/elixir-lang-core/8f4c4c17-a327-40a5-8928-318e8641341f%40googlegroups.com
>>>
><https://groups.google.com/d/msgid/elixir-lang-core/8f4c4c17-a327-40a5-8928-318e8641341f%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>>
>>
>> *José Valim*
>> www.plataformatec.com.br
>> Skype: jv.ptec
>> Founder and Director of R&D
>>
>> --
>> You received this message because you are subscribed to a topic in
>the
>> Google Groups "elixir-lang-core" group.
>> To unsubscribe from this topic, visit
>>
>https://groups.google.com/d/topic/elixir-lang-core/g22tkekQcMo/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> elixir-lang-core+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>>
>https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4JQiA0PnfZoJT6ZF5ZgmOVUZ%3Djkp1_0Qrs93%2B_MRwuqag%40mail.gmail.com
>>
><https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4JQiA0PnfZoJT6ZF5ZgmOVUZ%3Djkp1_0Qrs93%2B_MRwuqag%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
>-- 
>Onorio Catenacci
>
>http://onor.io
>http://www.google.com/+OnorioCatenacci
>
>-- 
>You received this message because you are subscribed to the Google
>Groups "elixir-lang-core" group.
>To unsubscribe from this group and stop receiving emails from it, send
>an email to elixir-lang-core+unsubscr...@googlegroups.com.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/elixir-lang-core/CAP%3DvNq9LjX9HhP4Ef0TSC-rMXG-m4J%3DybYKAhBm%3DJwoMd%2BioJw%40mail.gmail.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
Best wishes, 
Dmitry Belyaev

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/59793331-55D2-4236-B8B4-5F65F447E0D1%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to