Lazarus

Programming => Networking and Web Programming => Topic started by: devEric69 on June 17, 2019, 02:14:52 pm

Title: [Solved]Linux: list of all the existing the UNC network shortcuts ("smb://...")?
Post by: devEric69 on June 17, 2019, 02:14:52 pm
Hello,

I am under Linux \ Ubuntu desktop 18.04, on which I've created 2 UNC network shortcuts (one to another Linux machine and one to a Windows machine), both are therefore operational and of the type "smb://@IP/rep_shared".

Now, I would like to store all these shortcuts in a TStringList for example, but I don't see which text file to iterate to get them back (I found that it would be stored in the /etc/mtab or /etc/fstab file, but that's not the case).
Does anyone know a file to iterate in Laz. to get them, or another method (currently, I type these Samba addresses into the Nemo file manager, and they are created if the target machine is turned on, what I find practical;or am I totally forced to enter them manually in fstab, which I find more "static")?

Title: Re: Linux: list of all the existing the UNC network shortcuts ("smb://...")?
Post by: devEric69 on June 17, 2019, 05:21:39 pm
Well, finally, I create in the etc/fstab file, the network shortcuts that I find useful for starting the machine, aka permanent mounting points. Then, I iterate this file (bulk use of JclFileUtils and JclSysUtils where I commented all the functions not compiling because they are strictly dedicated to Windows, to be able to use _PATH_MNTAB, GetAvailableFileSystems, ..., and getmntent_r which returns each line of the fstab as a record).
- entries with a MNT_FSNAME='UUID=.../...' are " volume mount points " ('/',' /home',' swap', etc).
- entries with a MNT_FSNAME='//x.x.x.x.x.x/rep_shared' are " UNC network shortcuts mount points " created with the command "mount -t cifs .../...".
Title: Re: [Solved]Linux: list of all the existing the UNC network shortcuts ("smb://...")?
Post by: lucamar on June 18, 2019, 12:57:29 am
Wouldn't it be easier and less error prone to just parse the output of mount or udisks?

Or you could also interate the mount points root (v.g. /media/) checking the type of each "file".
TinyPortal © 2005-2018