opening files in read-only mode
Josh Guilfoyle
jasta at devtcg.org
Tue May 27 17:26:09 CEST 2008
Scott Wheeler wrote:
> Sergey 'Jin' Bostandzhyan wrote:
>> Hi,
>>
>> I need to be able to open the files in read only mode; I tried achieving this
>> by subclassing, but got nowhere. So unless I am missing something, it would
>> be very nice to get the ability to do something like
>>
>> TagLib::FileRef f("name", ro_parameter)
>>
>> Is there any chance that the API could be extended to support this?
>>
>
> I'm not specifically opposed to adding this, but if it's really
> triggering an inotify signal even when no writes occur that sounds like
> an inotify bug. Please add a wishlist item for this in the bug tracker.
The way inotify works is that it has an IN_WRITE event, which you can
use to detect an actual write to the file, but it also supports
IN_WRITE_CLOSE versus the normal IN_CLOSE so that you can detect when
close() is invoked on a writable file. This is done so that programs
which need to efficiently trigger on changed files do not have to trap
and react to every write() call on the file. When IN_WRITE_CLOSE is
fired, you can just generally check the mtime against the file to
determine if a change has actually occurred, and I do, though it seems
especially unclean for TagLib to not differentiate.
>
> (I'm still super busy at the moment -- per my recent blog post, I'm
> trying to finish up at my current job while trying to get a new company
> ready to launch.)
I'm happy to provide a patch, but it might need some massaging to fit
with the project's normal policy on backward compatibility.
>
> -Scott
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel
More information about the taglib-devel
mailing list