Re: Getting/Setting FinderInfo attributes using native Cocoa API?

2016-10-15 Thread Stephane Sudre
Actually, it's to put back some of them on a newly created folder. So
right now, it just retrieves the values as NSData objects but I've
added a hook to be able to convert the data to the real objects.

the - [NSFileManager copyItemAtPath:toPath:error:] API does copy at
least the FinderInfo and ResourceFork extended attributes (which are
the ones that I need). I haven't checked whether it was copying the
quarantine flag or the download history ones yet. So depending on your
needs, you may not need to use the copyfile API.


On Sat, Oct 15, 2016 at 9:20 AM, Allan Odgaard
 wrote:
> On 14 Oct 2016, at 23:33, Stephane Sudre wrote:
>
>> I ended up writing a category for NSManager to deal with this using
>> the xattr.h APIs. […]
>
>
> If the goal is to copy extended attributes (as one post alluded to) then
> there is the `COPYFILE_METADATA` flag which can be used with
> x-man-page://3/copyfile
>
> Although I seem to recall some crash issues when used with network drives,
> my code skips it for non-local drives with a reference to 
> but that report seems to have been marked “secret” so I can no longer read
> it…
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/dev.iceberg%40gmail.com
>
> This email sent to dev.iceb...@gmail.com



-- 
Packaging Resources - http://s.sudre.free.fr/Packaging.html

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Getting/Setting FinderInfo attributes using native Cocoa API?

2016-10-15 Thread Allan Odgaard

On 14 Oct 2016, at 23:33, Stephane Sudre wrote:


I ended up writing a category for NSManager to deal with this using
the xattr.h APIs. […]


If the goal is to copy extended attributes (as one post alluded to) then 
there is the `COPYFILE_METADATA` flag which can be used with 
x-man-page://3/copyfile


Although I seem to recall some crash issues when used with network 
drives, my code skips it for non-local drives with a reference to 
 but that report seems to have been marked “secret” 
so I can no longer read it…

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Getting/Setting FinderInfo attributes using native Cocoa API?

2016-10-14 Thread Stephane Sudre
I ended up writing a category for NSManager to deal with this using
the xattr.h APIs.

Something like:

- (NSDictionary *)PKG_extendedAttributesOfItemAtPath:(NSString
*)inPath error:(NSError *__autoreleasing *)outError;
- (BOOL)PKG_setExtendedAttributes:(NSDictionary *)inExtendedAttributes
ofItemAtPath:(NSString *)inPath error:(NSError *__autoreleasing
*)outError;


On Thu, Oct 13, 2016 at 6:47 PM, Gary L. Wade
 wrote:
> Write bugs for the ones where there's no non-deprecated method. I don't 
> recall all the values, but there may be UNIX-level functions to do some 
> things. And if there's no real way now, look up the info on the structures 
> and set them by way of the xattr calls.
> --
> Gary L. Wade (Sent from my iPad)
> http://www.garywade.com/
>
>> On Oct 13, 2016, at 9:21 AM, Stephane Sudre  wrote:
>>
>> No specific attributes in the FinderInfo data. I just need to be able
>> to get it and set it on another file/folder.
>>
>> The labels case you mention is an interesting one. I had not thought
>> about it when it comes to cross-compatibility with the different OS
>> versions I need to support.
>>
>> On Thu, Oct 13, 2016 at 4:45 PM, Gary L. Wade
>>  wrote:
>>> What attributes in particular do you need to work with? In case you might 
>>> be dealing with labels, those moved from the simple bitmask flag to 
>>> separate values in their own extended attribute. Other values may have 
>>> changed similarly but I haven't kept up with them.
>>> --
>>> Gary L. Wade (Sent from my iPad)
>>> http://www.garywade.com/
>>>
 On Oct 13, 2016, at 7:03 AM, Stephane Sudre  wrote:

 Question:

 Is there a native Cocoa API that can replace the
 FSGetCatalog/FSSetCatalog API when it comes to retrieving/setting the
 FinderInfo (and FinderExtInfo) attributes of a file?

 OS X 10.8 and later.

 Problem:

 The FS CoreCarbon APIs are deprecated but apparently, there's nothing
 to replace them completely in Cocoa (Foundation).

 The NSURL resources APIs does not support the FinderInfo attributes
 (no obvious key in the broken documentation and using
 "com.apple.FinderInfo" does not work).


 Workaround:

 This can be worked around by using the xattr.h APIs but if it could be
 possible to avoid this, it would be better.
>>
>>
>>
>> --
>> Packaging Resources - http://s.sudre.free.fr/Packaging.html
>



-- 
Packaging Resources - http://s.sudre.free.fr/Packaging.html

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Getting/Setting FinderInfo attributes using native Cocoa API?

2016-10-13 Thread Gary L. Wade
Write bugs for the ones where there's no non-deprecated method. I don't recall 
all the values, but there may be UNIX-level functions to do some things. And if 
there's no real way now, look up the info on the structures and set them by way 
of the xattr calls.
--
Gary L. Wade (Sent from my iPad)
http://www.garywade.com/

> On Oct 13, 2016, at 9:21 AM, Stephane Sudre  wrote:
> 
> No specific attributes in the FinderInfo data. I just need to be able
> to get it and set it on another file/folder.
> 
> The labels case you mention is an interesting one. I had not thought
> about it when it comes to cross-compatibility with the different OS
> versions I need to support.
> 
> On Thu, Oct 13, 2016 at 4:45 PM, Gary L. Wade
>  wrote:
>> What attributes in particular do you need to work with? In case you might be 
>> dealing with labels, those moved from the simple bitmask flag to separate 
>> values in their own extended attribute. Other values may have changed 
>> similarly but I haven't kept up with them.
>> --
>> Gary L. Wade (Sent from my iPad)
>> http://www.garywade.com/
>> 
>>> On Oct 13, 2016, at 7:03 AM, Stephane Sudre  wrote:
>>> 
>>> Question:
>>> 
>>> Is there a native Cocoa API that can replace the
>>> FSGetCatalog/FSSetCatalog API when it comes to retrieving/setting the
>>> FinderInfo (and FinderExtInfo) attributes of a file?
>>> 
>>> OS X 10.8 and later.
>>> 
>>> Problem:
>>> 
>>> The FS CoreCarbon APIs are deprecated but apparently, there's nothing
>>> to replace them completely in Cocoa (Foundation).
>>> 
>>> The NSURL resources APIs does not support the FinderInfo attributes
>>> (no obvious key in the broken documentation and using
>>> "com.apple.FinderInfo" does not work).
>>> 
>>> 
>>> Workaround:
>>> 
>>> This can be worked around by using the xattr.h APIs but if it could be
>>> possible to avoid this, it would be better.
> 
> 
> 
> -- 
> Packaging Resources - http://s.sudre.free.fr/Packaging.html


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Getting/Setting FinderInfo attributes using native Cocoa API?

2016-10-13 Thread Laurent Daudelin
I use the NSFileManager when accessing file’s attributes. That’s the only way I 
know in Cocoa.

-Laurent.
-- 
Laurent Daudelin
laur...@nemesys-soft.com 
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/ 
Logiciels Nemesys Software

> On Oct 13, 2016, at 12:21, Stephane Sudre  wrote:
> 
> No specific attributes in the FinderInfo data. I just need to be able
> to get it and set it on another file/folder.
> 
> The labels case you mention is an interesting one. I had not thought
> about it when it comes to cross-compatibility with the different OS
> versions I need to support.
> 
> On Thu, Oct 13, 2016 at 4:45 PM, Gary L. Wade
>  wrote:
>> What attributes in particular do you need to work with? In case you might be 
>> dealing with labels, those moved from the simple bitmask flag to separate 
>> values in their own extended attribute. Other values may have changed 
>> similarly but I haven't kept up with them.
>> --
>> Gary L. Wade (Sent from my iPad)
>> http://www.garywade.com/
>> 
>>> On Oct 13, 2016, at 7:03 AM, Stephane Sudre  wrote:
>>> 
>>> Question:
>>> 
>>> Is there a native Cocoa API that can replace the
>>> FSGetCatalog/FSSetCatalog API when it comes to retrieving/setting the
>>> FinderInfo (and FinderExtInfo) attributes of a file?
>>> 
>>> OS X 10.8 and later.
>>> 
>>> Problem:
>>> 
>>> The FS CoreCarbon APIs are deprecated but apparently, there's nothing
>>> to replace them completely in Cocoa (Foundation).
>>> 
>>> The NSURL resources APIs does not support the FinderInfo attributes
>>> (no obvious key in the broken documentation and using
>>> "com.apple.FinderInfo" does not work).
>>> 
>>> 
>>> Workaround:
>>> 
>>> This can be worked around by using the xattr.h APIs but if it could be
>>> possible to avoid this, it would be better.
>> 
> 
> 
> 
> -- 
> Packaging Resources - http://s.sudre.free.fr/Packaging.html
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/laurent%40nemesys-soft.com
> 
> This email sent to laur...@nemesys-soft.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Getting/Setting FinderInfo attributes using native Cocoa API?

2016-10-13 Thread Stephane Sudre
No specific attributes in the FinderInfo data. I just need to be able
to get it and set it on another file/folder.

The labels case you mention is an interesting one. I had not thought
about it when it comes to cross-compatibility with the different OS
versions I need to support.

On Thu, Oct 13, 2016 at 4:45 PM, Gary L. Wade
 wrote:
> What attributes in particular do you need to work with? In case you might be 
> dealing with labels, those moved from the simple bitmask flag to separate 
> values in their own extended attribute. Other values may have changed 
> similarly but I haven't kept up with them.
> --
> Gary L. Wade (Sent from my iPad)
> http://www.garywade.com/
>
>> On Oct 13, 2016, at 7:03 AM, Stephane Sudre  wrote:
>>
>> Question:
>>
>> Is there a native Cocoa API that can replace the
>> FSGetCatalog/FSSetCatalog API when it comes to retrieving/setting the
>> FinderInfo (and FinderExtInfo) attributes of a file?
>>
>> OS X 10.8 and later.
>>
>> Problem:
>>
>> The FS CoreCarbon APIs are deprecated but apparently, there's nothing
>> to replace them completely in Cocoa (Foundation).
>>
>> The NSURL resources APIs does not support the FinderInfo attributes
>> (no obvious key in the broken documentation and using
>> "com.apple.FinderInfo" does not work).
>>
>>
>> Workaround:
>>
>> This can be worked around by using the xattr.h APIs but if it could be
>> possible to avoid this, it would be better.
>



-- 
Packaging Resources - http://s.sudre.free.fr/Packaging.html

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Getting/Setting FinderInfo attributes using native Cocoa API?

2016-10-13 Thread Gary L. Wade
What attributes in particular do you need to work with? In case you might be 
dealing with labels, those moved from the simple bitmask flag to separate 
values in their own extended attribute. Other values may have changed similarly 
but I haven't kept up with them.
--
Gary L. Wade (Sent from my iPad)
http://www.garywade.com/

> On Oct 13, 2016, at 7:03 AM, Stephane Sudre  wrote:
> 
> Question:
> 
> Is there a native Cocoa API that can replace the
> FSGetCatalog/FSSetCatalog API when it comes to retrieving/setting the
> FinderInfo (and FinderExtInfo) attributes of a file?
> 
> OS X 10.8 and later.
> 
> Problem:
> 
> The FS CoreCarbon APIs are deprecated but apparently, there's nothing
> to replace them completely in Cocoa (Foundation).
> 
> The NSURL resources APIs does not support the FinderInfo attributes
> (no obvious key in the broken documentation and using
> "com.apple.FinderInfo" does not work).
> 
> 
> Workaround:
> 
> This can be worked around by using the xattr.h APIs but if it could be
> possible to avoid this, it would be better.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com