NNTagging Reference Library

NNFile Class Reference

NNFile Class Reference

Inherits from
Declared in NNFile.h

Overview

Represents a file that can be tagged. Uses a subclass of NNTagReaderWriter to access the backing storage.

Tasks

Class Methods

fileWithPath:

+ (NNFile *)fileWithPath:(NSString *)aPath
Parameters
aPath

path to file

Return Value

NNFile representing file at aPath

Discussion

create a new NNFile from a path

Declared In
NNFile.h

filesWithFilepaths:

+ (NSArray *)filesWithFilepaths:(NSArray *)filepaths
Parameters
filepaths

paths to file (NSArray of NSString)

Return Value

NSArray of NNFiles representing file at aPath

Discussion

create a new NSArray of NNFiles from a NSArray of file paths (NSString)

Declared In
NNFile.h

fileWithPath:displayName:kind:contentType:lastUsed:contentTypeTree:tags:

+ (NNFile *)fileWithPath:(NSString *)aPath displayName:(NSString *)aDisplayName kind:(NSString *)aKind contentType:(NSString *)aContentType lastUsed:(NSDate *)lastUsed contentTypeTree:(NSArray *)aContentTypeTree tags:(NSArray *)someTags
Discussion

Use this initializer to create a file without ever accessing the spotlight db. This is currently the fastest way!

Declared In
NNFile.h

Instance Methods

initWithPath:

- (id)initWithPath:(NSString *)aPath
Parameters
aPath

path to file

Return Value

NNFile representing file at aPath

Discussion

create a new NNFile from a path

Declared In
NNFile.h

initWithPath:displayName:kind:contentType:lastUsed:contentTypeTree:tags:

- (id)initWithPath:(NSString *)aPath displayName:(NSString *)aDisplayName kind:(NSString *)aKind contentType:(NSString *)aContentType lastUsed:(NSDate *)lastUsed contentTypeTree:(NSArray *)aContentTypeTree tags:(NSArray *)someTags
Parameters
aPath

Path to file

aDisplayName

Display name to use

aKind

File kind

aContentType

Content type

lastUsed

Date this file was last used

aContentTypeTree

Content type tree

someTags

tags on file

Return Value

New NNFile for params

Discussion

Use this initializer to create a file without ever accessing the spotlight db. This is currently the fastest way!

Declared In
NNFile.h

setPath:

- (void)setPath:(NSString *)path
Parameters
path

New file path

Declared In
NNFile.h

path

- (NSString *)path
Return Value

Full path including file.extension

Declared In
NNFile.h

standardizedPath

- (NSString *)standardizedPath
Return Value

Standardized path (stringByStandardizingPath)

Declared In
NNFile.h

filename

- (NSString *)filename
Return Value

File name including extension

Declared In
NNFile.h

url

- (NSURL *)url
Return Value

Full path as file URL

Declared In
NNFile.h

extension

- (NSString *)extension
Return Value

File extension

Declared In
NNFile.h

parentDirectory

- (NSString *)parentDirectory
Return Value

Directory path the file is located in

Declared In
NNFile.h

isDirectory

- (BOOL)isDirectory
Return Value

YES if file is a directory, NO otherwise

Declared In
NNFile.h

icon

- (NSImage *)icon
Return Value

Icon representing file

Declared In
NNFile.h

kind

- (NSString *)kind
Return Value

A description of the kind of item this file represents

Declared In
NNFile.h

creationDate

- (NSDate *)creationDate
Return Value

File creation date

Declared In
NNFile.h

modificationDate

- (NSDate *)modificationDate
Return Value

File modification date

Declared In
NNFile.h

size

- (unsigned long long)size
Return Value

File's logical size in bytes (data + resource fork). Does not work for folders.

Declared In
NNFile.h

isInManagedHierarchy

- (BOOL)isInManagedHierarchy
Return Value

YES if this is the case, NO otherwise

Discussion

Checks if the self is already located in the managed files directory (or a subdirectory).

Declared In
NNFile.h

loadTags

- (NSMutableSet *)loadTags
Return Value

tags read from storage

Discussion

loads tags from backing storage

Declared In
NNFile.m

destinationForNewFile:

- (NSString *)destinationForNewFile:(NSString *)fileName
Parameters
fileName

name of the new file

Return Value

complete path for the new file. save the drop data there

Discussion

helper method

returns the destination for a file to be written use this to get a destination for the dropped data, it will consider user settings of managing files

Declared In
NNFile.m

Last updated: 2010-5-13