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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/6e72e631-aee1-40d7-bc9c-2d083bea9b84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to