I use setUserTags:path: to set some data on a file. No error is
reported. I even traced each line as it executed, everything looks
good. In the debugger, after the call, I can also read the tags back
and get the new values. However, if I fire-up the command line, and
use mdimport to look at the data on that file, the only openmeta data
in there is :EA:kMDItemOMUserTagTime - no :EA:kMDItemOMUserTags or
kOMUserTags...
To make things weirder, at least in my mind, if I move the code that
sets the meta data to another thread
(detachNewThreadSelector:toTarget:withObject:), everything works
fine...
Anyone has any idea why moving the code to a separate thread would
make a difference? Any help greatly appreciated.
I think that if a file is created or modified, mdimport will import it. If you somehow manage to set tags on the file in the same second, but after mdimport has imported, then all the file mod times check out, since they are only accurate to one second, and it is not imported again.
Or some variation on that. Perhaps setting no tags, then 0.3 seconds later setting real tags?
You can call mdimport on a file with an nstask to force it to rescan,
Just some ideas
Tom
Sent from my iPad
On 2011-02-02, at 6:39 AM, MacPrawn <tec...@malus.ca> wrote:
> I use setUserTags:path: to set some data on a file. No error is > reported. I even traced each line as it executed, everything looks > good. In the debugger, after the call, I can also read the tags back > and get the new values. However, if I fire-up the command line, and > use mdimport to look at the data on that file, the only openmeta data > in there is :EA:kMDItemOMUserTagTime - no :EA:kMDItemOMUserTags or > kOMUserTags...
> To make things weirder, at least in my mind, if I move the code that > sets the meta data to another thread > (detachNewThreadSelector:toTarget:withObject:), everything works > fine...
> Anyone has any idea why moving the code to a separate thread would > make a difference? Any help greatly appreciated.
> Thanks!
> -- > You received this message because you are subscribed to the Google Groups "OpenMeta" group. > To post to this group, send email to openmeta@googlegroups.com. > To unsubscribe from this group, send email to openmeta+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/openmeta?hl=en.
Thanks Tom - actually quite helpful... I'll try the delayed approach,
see if it helps or not... But your explanation makes sense: spawning a
new thread would porbably delay the code a bit, and that would explain
that...
Thanks!
On Feb 2, 10:29 am, Tom Andersen <tom.ander...@gmail.com> wrote:
> I think that if a file is created or modified, mdimport will import it. If you somehow manage to set tags on the file in the same second, but after mdimport has imported, then all the file mod times check out, since they are only accurate to one second, and it is not imported again.
> Or some variation on that. Perhaps setting no tags, then 0.3 seconds later setting real tags?
> You can call mdimport on a file with an nstask to force it to rescan,
> Just some ideas
> Tom
> Sent from my iPad
> On 2011-02-02, at 6:39 AM, MacPrawn <tec...@malus.ca> wrote:
> > Hi everyone - I have a weird one.
> > I use setUserTags:path: to set some data on a file. No error is
> > reported. I even traced each line as it executed, everything looks
> > good. In the debugger, after the call, I can also read the tags back
> > and get the new values. However, if I fire-up the command line, and
> > use mdimport to look at the data on that file, the only openmeta data
> > in there is :EA:kMDItemOMUserTagTime - no :EA:kMDItemOMUserTags or
> > kOMUserTags...
> > To make things weirder, at least in my mind, if I move the code that
> > sets the meta data to another thread
> > (detachNewThreadSelector:toTarget:withObject:), everything works
> > fine...
> > Anyone has any idea why moving the code to a separate thread would
> > make a difference? Any help greatly appreciated.
> > Thanks!
> > --
> > You received this message because you are subscribed to the Google Groups "OpenMeta" group.
> > To post to this group, send email to openmeta@googlegroups.com.
> > To unsubscribe from this group, send email to openmeta+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/openmeta?hl=en.