NSURL: create stub for -getResourceValue:forKey:error:

Create an unimplemented stub for NSURL's -getResourceValue:... method,
which can gather a numerous set of information about a URL.

Define the constants which are passed into -getResourceValue:... for
requiring information so that a build that relies on this method does
not break.
This commit is contained in:
Daniel Ferreira 2017-06-22 06:44:40 +10:00 committed by Ivan Vučica
parent 41a00e1ad3
commit 2ec3c7bc27
3 changed files with 257 additions and 0 deletions

View file

@ -406,6 +406,11 @@ enum
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
- (BOOL) getResourceValue: (id*)value
forKey: (NSString *)key
error: (NSError**)error;
#endif
/**
* Returns an NSURLHandle instance which may be used to write data to the
* resource represented by the receiver URL, or read data from it.<br />
@ -453,6 +458,129 @@ enum
resourceDidFailLoadingWithReason: (NSString*)reason;
@end
/** URL Resource Value Constants **/
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
GS_EXPORT NSString* const NSURLNameKey;
GS_EXPORT NSString* const NSURLLocalizedNameKey;
GS_EXPORT NSString* const NSURLIsRegularFileKey;
GS_EXPORT NSString* const NSURLIsDirectoryKey;
GS_EXPORT NSString* const NSURLIsSymbolicLinkKey;
GS_EXPORT NSString* const NSURLIsVolumeKey;
GS_EXPORT NSString* const NSURLIsPackageKey;
GS_EXPORT NSString* const NSURLIsSystemImmutableKey;
GS_EXPORT NSString* const NSURLIsUserImmutableKey;
GS_EXPORT NSString* const NSURLIsHiddenKey;
GS_EXPORT NSString* const NSURLHasHiddenExtensionKey;
GS_EXPORT NSString* const NSURLCreationDateKey;
GS_EXPORT NSString* const NSURLContentAccessDateKey;
GS_EXPORT NSString* const NSURLContentModificationDateKey;
GS_EXPORT NSString* const NSURLAttributeModificationDateKey;
GS_EXPORT NSString* const NSURLLinkCountKey;
GS_EXPORT NSString* const NSURLParentDirectoryURLKey;
GS_EXPORT NSString* const NSURLVolumeURLKey;
GS_EXPORT NSString* const NSURLTypeIdentifierKey;
GS_EXPORT NSString* const NSURLLocalizedTypeDescriptionKey;
GS_EXPORT NSString* const NSURLLabelNumberKey;
GS_EXPORT NSString* const NSURLLabelColorKey;
GS_EXPORT NSString* const NSURLLocalizedLabelKey;
GS_EXPORT NSString* const NSURLEffectiveIconKey;
GS_EXPORT NSString* const NSURLCustomIconKey;
GS_EXPORT NSString* const NSURLFileSizeKey;
GS_EXPORT NSString* const NSURLFileAllocatedSizeKey;
GS_EXPORT NSString* const NSURLIsAliasFileKey;
GS_EXPORT NSString* const NSURLVolumeLocalizedFormatDescriptionKey;
GS_EXPORT NSString* const NSURLVolumeTotalCapacityKey;
GS_EXPORT NSString* const NSURLVolumeAvailableCapacityKey;
GS_EXPORT NSString* const NSURLVolumeResourceCountKey;
GS_EXPORT NSString* const NSURLVolumeSupportsPersistentIDsKey;
GS_EXPORT NSString* const NSURLVolumeSupportsSymbolicLinksKey;
GS_EXPORT NSString* const NSURLVolumeSupportsHardLinksKey;
GS_EXPORT NSString* const NSURLVolumeSupportsJournalingKey;
GS_EXPORT NSString* const NSURLVolumeIsJournalingKey;
GS_EXPORT NSString* const NSURLVolumeSupportsSparseFilesKey;
GS_EXPORT NSString* const NSURLVolumeSupportsZeroRunsKey;
GS_EXPORT NSString* const NSURLVolumeSupportsCaseSensitiveNamesKey;
GS_EXPORT NSString* const NSURLVolumeSupportsCasePreservedNamesKey;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
GS_EXPORT NSString* const NSURLFileResourceIdentifierKey;
GS_EXPORT NSString* const NSURLVolumeIdentifierKey;
GS_EXPORT NSString* const NSURLPreferredIOBlockSizeKey;
GS_EXPORT NSString* const NSURLIsReadableKey;
GS_EXPORT NSString* const NSURLIsWritableKey;
GS_EXPORT NSString* const NSURLIsExecutableKey;
GS_EXPORT NSString* const NSURLFileSecurityKey;
GS_EXPORT NSString* const NSURLIsMountTriggerKey;
GS_EXPORT NSString* const NSURLFileResourceTypeKey;
GS_EXPORT NSString* const NSURLTotalFileSizeKey;
GS_EXPORT NSString* const NSURLTotalFileAllocatedSizeKey;
GS_EXPORT NSString* const NSURLVolumeSupportsRootDirectoryDatesKey;
GS_EXPORT NSString* const NSURLVolumeSupportsVolumeSizesKey;
GS_EXPORT NSString* const NSURLVolumeSupportsRenamingKey;
GS_EXPORT NSString* const NSURLVolumeSupportsAdvisoryFileLockingKey;
GS_EXPORT NSString* const NSURLVolumeSupportsExtendedSecurityKey;
GS_EXPORT NSString* const NSURLVolumeIsBrowsableKey;
GS_EXPORT NSString* const NSURLVolumeMaximumFileSizeKey;
GS_EXPORT NSString* const NSURLVolumeIsEjectableKey;
GS_EXPORT NSString* const NSURLVolumeIsRemovableKey;
GS_EXPORT NSString* const NSURLVolumeIsInternalKey;
GS_EXPORT NSString* const NSURLVolumeIsAutomountedKey;
GS_EXPORT NSString* const NSURLVolumeIsLocalKey;
GS_EXPORT NSString* const NSURLVolumeIsReadOnlyKey;
GS_EXPORT NSString* const NSURLVolumeCreationDateKey;
GS_EXPORT NSString* const NSURLVolumeURLForRemountingKey;
GS_EXPORT NSString* const NSURLVolumeUUIDStringKey;
GS_EXPORT NSString* const NSURLVolumeNameKey;
GS_EXPORT NSString* const NSURLVolumeLocalizedNameKey;
GS_EXPORT NSString* const NSURLIsUbiquitousItemKey;
GS_EXPORT NSString* const NSURLUbiquitousItemHasUnresolvedConflictsKey;
GS_EXPORT NSString* const NSURLUbiquitousItemIsDownloadingKey;
GS_EXPORT NSString* const NSURLUbiquitousItemIsUploadedKey;
GS_EXPORT NSString* const NSURLUbiquitousItemIsUploadingKey;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST)
GS_EXPORT NSString* const NSURLIsExcludedFromBackupKey;
GS_EXPORT NSString* const NSURLPathKey;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
GS_EXPORT NSString* const NSURLTagNamesKey;
GS_EXPORT NSString* const NSURLUbiquitousItemDownloadingStatusKey;
GS_EXPORT NSString* const NSURLUbiquitousItemDownloadingErrorKey;
GS_EXPORT NSString* const NSURLUbiquitousItemUploadingErrorKey;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
GS_EXPORT NSString* const NSURLGenerationIdentifierKey;
GS_EXPORT NSString* const NSURLDocumentIdentifierKey;
GS_EXPORT NSString* const NSURLAddedToDirectoryDateKey;
GS_EXPORT NSString* const NSURLQuarantinePropertiesKey;
GS_EXPORT NSString* const NSThumbnail1024x1024SizeKey;
GS_EXPORT NSString* const NSURLUbiquitousItemDownloadRequestedKey;
GS_EXPORT NSString* const NSURLUbiquitousItemContainerDisplayNameKey;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
GS_EXPORT NSString* const NSURLIsApplicationKey;
GS_EXPORT NSString* const NSURLApplicationIsScriptableKey;
#endif
/** Possible values for File Resource Type Key **/
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
GS_EXPORT NSString* const NSURLFileResourceTypeNamedPipe;
GS_EXPORT NSString* const NSURLFileResourceTypeCharacterSpecial;
GS_EXPORT NSString* const NSURLFileResourceTypeDirectory;
GS_EXPORT NSString* const NSURLFileResourceTypeBlockSpecial;
GS_EXPORT NSString* const NSURLFileResourceTypeRegular;
GS_EXPORT NSString* const NSURLFileResourceTypeSymbolicLink;
GS_EXPORT NSString* const NSURLFileResourceTypeSocket;
GS_EXPORT NSString* const NSURLFileResourceTypeUnknown;
#endif
/** Possible values for Ubiquitous Item Downloading Key **/
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
GS_EXPORT NSString* const NSURLUbiquitousItemDownloadingStatusNotDownloaded;
GS_EXPORT NSString* const NSURLUbiquitousItemDownloadingStatusDownloaded;
GS_EXPORT NSString* const NSURLUbiquitousItemDownloadingStatusCurrent;
#endif
#endif /* GS_API_MACOSX */
#if defined(__cplusplus)

View file

@ -1561,6 +1561,14 @@ static NSUInteger urlAlign;
return [[self path] lastPathComponent];
}
- (BOOL) getResourceValue: (id*)value
forKey: (NSString *)key
error: (NSError**)error
{
// TODO: unimplemented
return NO;
}
- (void) loadResourceDataNotifyingClient: (id)client
usingCache: (BOOL)shouldUseCache
{

View file

@ -90,6 +90,127 @@ NSString *NSUndoManagerWillUndoChangeNotification = @"NSUndoManagerWillUndoChang
/* NSURL constants */
NSString *NSURLFileScheme = @"file";
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
NSString *NSURLNameKey = @"NSURLNameKey";
NSString *NSURLLocalizedNameKey = @"NSURLLocalizedNameKey";
NSString *NSURLIsRegularFileKey = @"NSURLIsRegularFileKey";
NSString *NSURLIsDirectoryKey = @"NSURLIsDirectoryKey";
NSString *NSURLIsSymbolicLinkKey = @"NSURLIsSymbolicLinkKey";
NSString *NSURLIsVolumeKey = @"NSURLIsVolumeKey";
NSString *NSURLIsPackageKey = @"NSURLIsPackageKey";
NSString *NSURLIsSystemImmutableKey = @"NSURLIsSystemImmutableKey";
NSString *NSURLIsUserImmutableKey = @"NSURLIsUserImmutableKey";
NSString *NSURLIsHiddenKey = @"NSURLIsHiddenKey";
NSString *NSURLHasHiddenExtensionKey = @"NSURLHasHiddenExtensionKey";
NSString *NSURLCreationDateKey = @"NSURLCreationDateKey";
NSString *NSURLContentAccessDateKey = @"NSURLContentAccessDateKey";
NSString *NSURLContentModificationDateKey = @"NSURLContentModificationDateKey";
NSString *NSURLAttributeModificationDateKey = @"NSURLAttributeModificationDateKey";
NSString *NSURLLinkCountKey = @"NSURLLinkCountKey";
NSString *NSURLParentDirectoryURLKey = @"NSURLParentDirectoryURLKey";
NSString *NSURLVolumeURLKey = @"NSURLVolumeURLKey";
NSString *NSURLTypeIdentifierKey = @"NSURLTypeIdentifierKey";
NSString *NSURLLocalizedTypeDescriptionKey = @"NSURLLocalizedTypeDescriptionKey";
NSString *NSURLLabelNumberKey = @"NSURLLabelNumberKey";
NSString *NSURLLabelColorKey = @"NSURLLabelColorKey";
NSString *NSURLLocalizedLabelKey = @"NSURLLocalizedLabelKey";
NSString *NSURLEffectiveIconKey = @"NSURLEffectiveIconKey";
NSString *NSURLCustomIconKey = @"NSURLCustomIconKey";
NSString *NSURLFileSizeKey = @"NSURLFileSizeKey";
NSString *NSURLFileAllocatedSizeKey = @"NSURLFileAllocatedSizeKey";
NSString *NSURLIsAliasFileKey = @"NSURLIsAliasFileKey";
NSString *NSURLVolumeLocalizedFormatDescriptionKey = @"NSURLVolumeLocalizedFormatDescriptionKey";
NSString *NSURLVolumeTotalCapacityKey = @"NSURLVolumeTotalCapacityKey";
NSString *NSURLVolumeAvailableCapacityKey = @"NSURLVolumeAvailableCapacityKey";
NSString *NSURLVolumeResourceCountKey = @"NSURLVolumeResourceCountKey";
NSString *NSURLVolumeSupportsPersistentIDsKey = @"NSURLVolumeSupportsPersistentIDsKey";
NSString *NSURLVolumeSupportsSymbolicLinksKey = @"NSURLVolumeSupportsSymbolicLinksKey";
NSString *NSURLVolumeSupportsHardLinksKey = @"NSURLVolumeSupportsHardLinksKey";
NSString *NSURLVolumeSupportsJournalingKey = @"NSURLVolumeSupportsJournalingKey";
NSString *NSURLVolumeIsJournalingKey = @"NSURLVolumeIsJournalingKey";
NSString *NSURLVolumeSupportsSparseFilesKey = @"NSURLVolumeSupportsSparseFilesKey";
NSString *NSURLVolumeSupportsZeroRunsKey = @"NSURLVolumeSupportsZeroRunsKey";
NSString *NSURLVolumeSupportsCaseSensitiveNamesKey = @"NSURLVolumeSupportsCaseSensitiveNamesKey";
NSString *NSURLVolumeSupportsCasePreservedNamesKey = @"NSURLVolumeSupportsCasePreservedNamesKey";
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
NSString *NSURLFileResourceIdentifierKey = @"NSURLFileResourceIdentifierKey";
NSString *NSURLVolumeIdentifierKey = @"NSURLVolumeIdentifierKey";
NSString *NSURLPreferredIOBlockSizeKey = @"NSURLPreferredIOBlockSizeKey";
NSString *NSURLIsReadableKey = @"NSURLIsReadableKey";
NSString *NSURLIsWritableKey = @"NSURLIsWritableKey";
NSString *NSURLIsExecutableKey = @"NSURLIsExecutableKey";
NSString *NSURLFileSecurityKey = @"NSURLFileSecurityKey";
NSString *NSURLIsMountTriggerKey = @"NSURLIsMountTriggerKey";
NSString *NSURLFileResourceTypeKey = @"NSURLFileResourceTypeKey";
NSString *NSURLTotalFileSizeKey = @"NSURLTotalFileSizeKey";
NSString *NSURLTotalFileAllocatedSizeKey = @"NSURLTotalFileAllocatedSizeKey";
NSString *NSURLVolumeSupportsRootDirectoryDatesKey = @"NSURLVolumeSupportsRootDirectoryDatesKey";
NSString *NSURLVolumeSupportsVolumeSizesKey = @"NSURLVolumeSupportsVolumeSizesKey";
NSString *NSURLVolumeSupportsRenamingKey = @"NSURLVolumeSupportsRenamingKey";
NSString *NSURLVolumeSupportsAdvisoryFileLockingKey = @"NSURLVolumeSupportsAdvisoryFileLockingKey";
NSString *NSURLVolumeSupportsExtendedSecurityKey = @"NSURLVolumeSupportsExtendedSecurityKey";
NSString *NSURLVolumeIsBrowsableKey = @"NSURLVolumeIsBrowsableKey";
NSString *NSURLVolumeMaximumFileSizeKey = @"NSURLVolumeMaximumFileSizeKey";
NSString *NSURLVolumeIsEjectableKey = @"NSURLVolumeIsEjectableKey";
NSString *NSURLVolumeIsRemovableKey = @"NSURLVolumeIsRemovableKey";
NSString *NSURLVolumeIsInternalKey = @"NSURLVolumeIsInternalKey";
NSString *NSURLVolumeIsAutomountedKey = @"NSURLVolumeIsAutomountedKey";
NSString *NSURLVolumeIsLocalKey = @"NSURLVolumeIsLocalKey";
NSString *NSURLVolumeIsReadOnlyKey = @"NSURLVolumeIsReadOnlyKey";
NSString *NSURLVolumeCreationDateKey = @"NSURLVolumeCreationDateKey";
NSString *NSURLVolumeURLForRemountingKey = @"NSURLVolumeURLForRemountingKey";
NSString *NSURLVolumeUUIDStringKey = @"NSURLVolumeUUIDStringKey";
NSString *NSURLVolumeNameKey = @"NSURLVolumeNameKey";
NSString *NSURLVolumeLocalizedNameKey = @"NSURLVolumeLocalizedNameKey";
NSString *NSURLIsUbiquitousItemKey = @"NSURLIsUbiquitousItemKey";
NSString *NSURLUbiquitousItemHasUnresolvedConflictsKey = @"NSURLUbiquitousItemHasUnresolvedConflictsKey";
NSString *NSURLUbiquitousItemIsDownloadingKey = @"NSURLUbiquitousItemIsDownloadingKey";
NSString *NSURLUbiquitousItemIsUploadedKey = @"NSURLUbiquitousItemIsUploadedKey";
NSString *NSURLUbiquitousItemIsUploadingKey = @"NSURLUbiquitousItemIsUploadingKey";
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST)
NSString *NSURLIsExcludedFromBackupKey = @"NSURLIsExcludedFromBackupKey";
NSString *NSURLPathKey = @"NSURLPathKey";
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
NSString *NSURLTagNamesKey = @"NSURLTagNamesKey";
NSString *NSURLUbiquitousItemDownloadingStatusKey = @"NSURLUbiquitousItemDownloadingStatusKey";
NSString *NSURLUbiquitousItemDownloadingErrorKey = @"NSURLUbiquitousItemDownloadingErrorKey";
NSString *NSURLUbiquitousItemUploadingErrorKey = @"NSURLUbiquitousItemUploadingErrorKey";
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
NSString *NSURLGenerationIdentifierKey = @"NSURLGenerationIdentifierKey";
NSString *NSURLDocumentIdentifierKey = @"NSURLDocumentIdentifierKey";
NSString *NSURLAddedToDirectoryDateKey = @"NSURLAddedToDirectoryDateKey";
NSString *NSURLQuarantinePropertiesKey = @"NSURLQuarantinePropertiesKey";
NSString *NSThumbnail1024x1024SizeKey = @"NSThumbnail1024x1024SizeKey";
NSString *NSURLUbiquitousItemDownloadRequestedKey = @"NSURLUbiquitousItemDownloadRequestedKey";
NSString *NSURLUbiquitousItemContainerDisplayNameKey = @"NSURLUbiquitousItemContainerDisplayNameKey";
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
NSString *NSURLIsApplicationKey = @"NSURLIsApplicationKey";
NSString *NSURLApplicationIsScriptableKey = @"NSURLApplicationIsScriptableKey";
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
NSString *NSURLFileResourceTypeNamedPipe = @"NSURLFileResourceTypeNamedPipe";
NSString *NSURLFileResourceTypeCharacterSpecial = @"NSURLFileResourceTypeCharacterSpecial";
NSString *NSURLFileResourceTypeDirectory = @"NSURLFileResourceTypeDirectory";
NSString *NSURLFileResourceTypeBlockSpecial = @"NSURLFileResourceTypeBlockSpecial";
NSString *NSURLFileResourceTypeRegular = @"NSURLFileResourceTypeRegular";
NSString *NSURLFileResourceTypeSymbolicLink = @"NSURLFileResourceTypeSymbolicLink";
NSString *NSURLFileResourceTypeSocket = @"NSURLFileResourceTypeSocket";
NSString *NSURLFileResourceTypeUnknown = @"NSURLFileResourceTypeUnknown";
#endif
/** Possible values for Ubiquitous Item Downloading Key **/
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
NSString *NSURLUbiquitousItemDownloadingStatusNotDownloaded = @"NSURLUbiquitousItemDownloadingStatusNotDownloaded";
NSString *NSURLUbiquitousItemDownloadingStatusDownloaded = @"NSURLUbiquitousItemDownloadingStatusDownloaded";
NSString *NSURLUbiquitousItemDownloadingStatusCurrent = @"NSURLUbiquitousItemDownloadingStatusCurrent";
#endif
/* RunLoop modes */
NSString *NSConnectionReplyMode = @"NSConnectionReplyMode";