Source path when pasting a copied item to a new location

43 views
Skip to first unread message

nirla...@gmail.com

unread,
Dec 22, 2014, 2:13:18 AM12/22/14
to osxfus...@googlegroups.com
Hi,
Hello,
I am using the OS X fuse with a combination of the 2 provided samples:
HelloFS
LoopbackFS
My project combining both local files and virtual files (a simple NSArray with strings which represents filenames).

I am trying to handle copy item from their source path to another destination.
Since i have 2 types of items (virtual and local) I need to get the source path of the copied item, in order to distinct between a virtual and a local item.
From what I saw, the delegates which called when I paste a copied item, in the new location, are (in their chronicle order):

1. - (NSDictionary *)attributesOfItemAtPath:(NSString *)path userData:(id)userData error:(NSError **)error

2. - (BOOL)openFileAtPath:(NSString *)path mode:(int)mode userData:(id *)userData error:(NSError **)error

and then:
3. - (BOOL)createFileAtPath:(NSString *)path attributes:(NSDictionary *)attributes userData:(id *)userData error:(NSError **)error

So, I have an event call when a file create (pasted), but I do i know its source path? 
Is there any other method I can use?

Thanks!
Nir

Sam Moffatt

unread,
Dec 22, 2014, 8:40:42 PM12/22/14
to osxfus...@googlegroups.com
As I hinted at in my last email, you're not going to know where the data is coming from when a file is being created. It could be a file copy or it could be someone creating a new file. 

What you might want to try and see is if you can add an extended attribute to your virtual files and then if you see something creating that attribute to remove the on disk version and convert it to a virtual file. You need to be careful because Finder may complain if what you return differs to what it thinks should be the case. The extended attributes should be copied however I haven't thoroughly tested that. 

Cheers,

Sam

--
Sam Moffatt

Note: I'm not at my desk, responses may be delayed. Apologies for the typos, smartphones aren't all that smart. 

--
You received this message because you are subscribed to the Google Groups "OSXFUSE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osxfuse-grou...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

nirla...@gmail.com

unread,
Dec 23, 2014, 7:50:46 AM12/23/14
to osxfus...@googlegroups.com
Thanks Sam,
I to add to extended attribute and regular attribute to my virtual files, but when I am copying an item, the delegates:

- (BOOL)createFileAtPath:(NSString *)path attributes:(NSDictionary *)attributes userData:(id *)userData error:(NSError **)error
and

- (BOOL)setExtendedAttribute:(NSString *)name  ofItemAtPath:(NSString *)path value:(NSData *)value position:(off_t)position  options:(int)options error:(NSError **)error

are being called but i get nothing special, or from what I add, in the attributes?
Is this the right way?

Thanks again!
Reply all
Reply to author
Forward
0 new messages