Boost logo

Boost Users :

Subject: [Boost-users] boost::filesystem is not detecting symlinks on Linux /sys/devices directory
From: Conrad Whelan (conrad.whelan_at_[hidden])
Date: 2010-02-24 14:27:17


Hi,

I'm writing some code to query the PCI bus for active devices. It should be pretty straightforward, as sysfs maps device information into the linux filesystem in the /sys directory. I simply need to recursively scan this directory until I find the device file corresponding to the devices of interest. I am having trouble with the scanning, using the boost::filesystem library.

It seems that the is_symlink function on a path iterator is not correctly detecting a symlink. It correctly determines that the symlink is a directory, but not that it's a symlink. Simply put, I want my recursive code to follow normal directories, but not symlink directories... as it is, there is circular linkage through the /sys directory if I follow symlinks, so the loop goes infinite.

Does anyone know how to distinguish between normal directories and symlink directories using boost::filesystem?

thanks,
conrad


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net