CharlesO

CharlesO

Unable to access files in windows shared directory

I get the following error, when I try to access files in windows shared directory:
(I can view the directory in file explorer, so I know it is not a permission issue)

Erlang/OTP 21 [erts-10.1] [64-bit] [smp:6:6] [ds:6:6:10] [async-threads:1]

Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> s =  ~S"\\flsv\Finance_Dept\FUND ACCOUNTING UNIT\\27112018"   
"\\\\flsv\\Finance_Dept\\FUND ACCOUNTING UNIT\\27112018"
iex(2)> s = "//flsv/Finance_Dept/FUND ACCOUNTING UNIT/27112018/"  
"//flsv/Finance_Dept/FUND ACCOUNTING UNIT/27112018/"
iex(3)> File.ls s
{:error, :enoent}

Most Liked

OvermindDL1

OvermindDL1

I’m not sure the BEAM would support UNC Paths, I’m pretty sure it only supports File Paths. You’d probably need to map the drive.

There might be some functions that accidentally do, but I doubt most would.

However, a NIF or Port could easily work around that by supplying a replacement File module (UNCFile maybe?).

The other bet would be to send a PR to the BEAM Erlang core to fix it’s underlying library (which I think they’d accept since many of the functions work anyway).

OvermindDL1

OvermindDL1

No, UNC is purely a Windows invention. The rest of the world uses URI’s. Given a UNC path like "\flsv\Finance_Dept\FUND ACCOUNTING UNIT\27112018the URI version would befile://flsv/Finance_dept/FUND%20ACCOUNTING%20UNIT/27112018`, which ‘is’ supported by unix’s via their extended interfaces (the root posix interfaces support only filepath syntax, I’m pretty sure the BEAM uses the posix calls).

You know how Windows always has to not follow standards, invent their own thing (why do you think they chose \ as the path separator instead of the already standardized /. :wink: .)

CharlesO

CharlesO

I just found this:

OTP-15333    Application(s): erts
                Related Id(s): ERL-737

                File access through UNC paths works again on Windows.
                This regression was introduced in OTP 21.
OvermindDL1

OvermindDL1

Wouldn’t work either way sadly, Windows doesn’t support accessing files over it’s shares without UNC using it’s normal interfaces (without using a network library that uses it that is).

Ooo, has it been fixed in the recently released 21.2 maybe? You should give it a try! :slight_smile:

Where Next?

Popular in Questions Top

gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
Werner
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”: 14:57:30.512 [warn] ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
Mooodi
Given a string, how can I get access to its character by index? Enum.at("my_string", 2) doesn't work. Or rather, not char, but a substr...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement