First day erlang, pretty cool! I wrote an escript with recursive directory copying, throwing exceptions, anon function, etc. Reading learnyousomeerlang, all over the docs all day, yt erlang tutorial on records, searched the forum and I’m all busted on read_link_info(Name, Opts) though.
Docs say it returns a record which looks like a tuple in a tuple. Converting to lists + methods doesn’t work; members, keyfind. Records seem to use # but not getting it and feeling stupid and blocked, I’m missing something huge, it’s so simple.
Objective: Check the returned record for type symlink.
information about the link is returned in the file_info record and the type field of the record is set to symlink .
Both in erl and with escript with header library imported.
I’ve tried like every variation on that, assignments, just variable FileInfo with the ok tuple leader, omitted file_info, using name, and got no where with anything.
That’s the exact same semantics I used! It must be that it can only be done in compiled Erlang and not erl or escript. Kinda makes sense, but when I did it in escript and erl it would output something like:
So I thought I could retrieve the value in the intended form. WRONG. I was wondering where the keys were! Apparently the lib also provides the return record data structure as well.
I did exactly as you said, screenshot at the Tildeverse-like Shared Linux Host envs.net since as a new user I cannot upload - just wanted you to know I did the work for the help.
I wanted, verge of needed, it to work in escript so bad, I’m too headstrong for my own good sometimes! Guess I’ll have to use some conversion muck in the end, dang. Sucks for escript as read_file_info et al. is a pretty basic need for sysadmin scripts.
It probably can be done in shell too, via rr command but it’s not very convenient to include records in shell. In few years of Erlang, I’ve done it for the first time today:
Oh man, it was F-Secure Antivirus blocking it with no notification. I got it figured out. Even though you would not have known, I was gonna keep thinking this was an erlang escript issue.
Way to hang in there and disabusing me of my assumption, I really do appreciate that.