ProjectManager 0.2
FileManager Class Reference
Inheritance diagram for FileManager:
<ProjectModule>

Instance Methods

(id) - delegate
 
(void) - openFile:
 
(void) - browser:createRowsForColumn:inMatrix:
 
(NSString *) - browser:titleOfColumn:
 
(void) - selectFile:
 
(void) - changeName:
 Action sent when the selected file's name in the fileName text field is edited by the user.
 
(void) - selectAndEditNameAtPath:
 Instructs the browser to set it's path to ‘aPath’, selects name of the entry in the fileName text field and allows the user to edit it.
 
(NSArray *) - selectedFiles
 Returns the paths to the files that are currently selected, otherwise nil.
 
(NSString *) - containingCategory
 Returns a path to the category which contains the current selection.
 
(BOOL) - performDragOperation:
 Instructs the file manager to perform a drag operation.
 
(BOOL) - openPath:
 Opens the file at ‘aPath’.
 
(BOOL) - fileExistsAtPath:
 Determines whether a file exists at ‘aPath’.
 
(NSArray *) - filesAtPath:
 Lists the files contained in the category at path ‘category’.
 
(FMFileType) - typeOfFileAtPath:
 Queries the file type at path ‘aPath’.
 
(NSString *) - targetOfLinkAtPath:
 Queries the target of the link at path ‘aPath’.
 
(unsigned long long) - measureDiskUsageAtPath:
 Measures the disk usage of files at and under path ‘aPath’.
 
(NSString *) - pathToFileAtPhysicalPath:
 Attempts to locate a file in the project based on it's physical disk location.
 
(NSArray *) - filesAtPath:ofType:recursive:
 Returns a list of files of a specified type in a category.
 
(BOOL) - importFile:toPath:link:error:
 A shorthand for -[FileManager importFile:renameTo:toPath:link:error:] with the rename filename being the same as the original file path.
 
(BOOL) - importFile:renameTo:toPath:link:error:
 Imports a specified on-disk file into the project.
 
(BOOL) - createCategory:atPath:error:
 Creates an empty category named ‘categoryName’ in category ‘category’.
 
(BOOL) - createCategoryAndIntermediateCategories:error:
 If necessary, creates a category and all intermediate category nodes on the way to it.
 
(BOOL) - createVirtualFileNamed:atPath:error:
 Creates a virtual file named ‘filename’ in category ‘category’.
 
(BOOL) - removePath:delete:error:
 Removes the specified file at ‘aPath’.
 
(BOOL) - copyPath:toPath:error:
 Copies a specified file to a new location.
 
(BOOL) - movePath:toPath:error:
 Moves a specified file to a new location.
 
(BOOL) - linkPath:fromPath:error:
 Links a specified file from a new location.
 
(NSImage *) - iconForPath:
 Returns an iconic representation of ‘aPath’.
 
(void) - importFiles:
 
(void) - newEmptyFile:
 
(void) - newFileFromTemplate:
 
(void) - newCategory:
 
(void) - deleteFiles:
 
(void) - filesChanged:
 
(void) - projectNameChanged:
 
- Instance Methods inherited from <ProjectModule>
(id) - initWithDocument:infoDictionary:
 Designated initializer of project modules.
 
(void) - finishInit
 Finishes the initialization process of the project module.
 
(ProjectDocument *) - document
 Should return the owner project document to which this project module belongs to.
 
(NSView *) - view
 Instructs the project module to return a view which will be put into the project's window this module becomes the current module.
 
(NSDictionary *) - infoDictionary
 Instructs the project module to return an archivable version of it's data that it wishes to be saved together with the project.
 
(BOOL) - regenerateDerivedFiles
 Sent to the project module when it is to regenerate it's derived files which are generated from other files/data in the project itself.
 
(NSArray *) - moduleMenuItems
 Should return an array of NSMenuItem's which will be put into the module's submenu.
 
(NSArray *) - toolbarItemIdentifiers
 A module should return the default toolbar item identifiers for it's toolbar.
 
(NSToolbarItem *) - toolbarItemForItemIdentifier:
 This method asks the module to create a toolbar item for the provided itemIdentifier.
 
(BOOL) - validateToolbarItem:
 This method is invoked when the project type object is required to validate it's toolbar items.
 

Protected Attributes

id view
 
id bogusWindow
 
ProjectBrowserbrowser
 
ProjectImageViewfileIcon
 
NSTextField * fileNameField
 
NSTextField * filePathField
 
NSTextField * fileSizeField
 
NSTextField * fileTypeField
 
NSTextField * lastModifiedField
 
NSMutableArray * files
 
id< FileManagerDelegatedelegate
 
ProjectDocumentdocument
 

Additional Inherited Members

- Class Methods inherited from <ProjectModule>
(NSString *) + moduleName
 Should return a unique module identifier name.
 
(NSString *) + humanReadableModuleName
 

Method Documentation

◆ copyPath:toPath:error:

- (BOOL) copyPath: (NSString *) aPath
toPath: (NSString *) newPath
error: (NSError **) error 

Copies a specified file to a new location.

Returns
YES if the operation succeeds, NO otherwise.

◆ createCategory:atPath:error:

- (BOOL) createCategory: (NSString *) categoryName
atPath: (NSString *) category
error: (NSError **) error 

Creates an empty category named ‘categoryName’ in category ‘category’.

Returns
YES if the operation succeeds, NO otherwise.

◆ createCategoryAndIntermediateCategories:error:

- (BOOL) createCategoryAndIntermediateCategories: (NSString *) category
error: (NSError **) error 

If necessary, creates a category and all intermediate category nodes on the way to it.

Parameters
categoryThe category which to create.
errorA pointer to location which will be set to an NSError object in case an error occurs.
Returns
YES if the operation succeeds, NO if it doesn't.

◆ createVirtualFileNamed:atPath:error:

- (BOOL) createVirtualFileNamed: (NSString *) filename
atPath: (NSString *) category
error: (NSError **) error 

Creates a virtual file named ‘filename’ in category ‘category’.

Returns
YES if the operation succeeds, NO otherwise.

◆ fileExistsAtPath:

- (BOOL) fileExistsAtPath: (NSString *) aPath

Determines whether a file exists at ‘aPath’.

Returns
YES if the file exists, otherwise NO.

◆ filesAtPath:

- (NSArray *) filesAtPath: (NSString *) category

Lists the files contained in the category at path ‘category’.

Returns
An array of filenames of files contained in the category, or ‘nil’ if ‘category’ doesn't exist or isn't a category file type.

◆ filesAtPath:ofType:recursive:

- (NSArray *) filesAtPath: (NSString *) aCategory
ofType: (FMFileType) aFileType
recursive: (BOOL) recursive 

Returns a list of files of a specified type in a category.

This method looks for the specified file type only, and also allows to specify whether the lookup should be recursive.

◆ importFile:renameTo:toPath:link:error:

- (BOOL) importFile: (NSString *) filePath
renameTo: (NSString *) newName
toPath: (NSString *) category
link: (BOOL) linkFlag
error: (NSError **) error 

Imports a specified on-disk file into the project.

Parameters
filePathThe on-disk file which to import into the project.
newNameA filename (only the last path component) to which the imported file will be renamed in the project.
categoryThe category into which to import the file.
linkFlagIf set to NO, the file, if located in an unsuitable location outside the project, will be copied into the path. If YES is passed, it will be linked to without copying.
errorA pointer to a location which will be set to point to an NSError object in case an error arises during the operation.
Returns
YES if the import succeeds, NO if it isn't.

◆ linkPath:fromPath:error:

- (BOOL) linkPath: (NSString *) aPath
fromPath: (NSString *) newPath
error: (NSError **) error 

Links a specified file from a new location.

Only links to plain files and other links are supported.

Parameters
aPathThe path to which to link.
newPathThe path where to create the link.
Returns
YES if the operation succeeds, NO if it doesn't.

◆ measureDiskUsageAtPath:

- (unsigned long long) measureDiskUsageAtPath: (NSString *) aPath

Measures the disk usage of files at and under path ‘aPath’.

Returns
The disk usage in bytes.

◆ movePath:toPath:error:

- (BOOL) movePath: (NSString *) aPath
toPath: (NSString *) newPath
error: (NSError **) error 

Moves a specified file to a new location.

Parameters
aPathThe path from which to move the file.
newPathThe path to which to move the file.
errorA pointer to a location which will be filled with an error description in case the operation fails.
Returns
YES if the operation succeeds, NO otherwise.

◆ openPath:

- (BOOL) openPath: (NSString *) aPath

Opens the file at ‘aPath’.

This method is invoked when the user requests to open a file, but the delegate responded that it cannot handle that open request.

Returns
YES if the open operation succeeds, NO otherwise.

◆ pathToFileAtPhysicalPath:

- (NSString *) pathToFileAtPhysicalPath: (NSString *) diskLocation

Attempts to locate a file in the project based on it's physical disk location.

This method searches the project's categories for a file which exists at the specified on-disk location and returns the path to it in the project.

Parameters
diskLocationThe physical location of the file.
Returns
The location in the project where the file is registered, or ‘nil’ if no such file exists.

◆ performDragOperation:

- (BOOL) performDragOperation: (id <NSDraggingInfo>) sender

Instructs the file manager to perform a drag operation.

The drag operation is specified by ‘sender’. The operation source is fully specified by the ‘sender’ argument, the destination is the current file browser path.

Returns
YES if the drag operation succeeds, NO otherwise.

◆ removePath:delete:error:

- (BOOL) removePath: (NSString *) aPath
delete: (BOOL) deleteFlag
error: (NSError **) error 

Removes the specified file at ‘aPath’.

Removes the path ‘aPath’, deleting any underlying disk files if ‘deleteFlag’ = YES.

If deleteFlag = YES, then any disk files and links are deleted from disk as well.

Returns
YES if the operation succeeds, NO otherwise.

◆ targetOfLinkAtPath:

- (NSString *) targetOfLinkAtPath: (NSString *) aPath

Queries the target of the link at path ‘aPath’.

Returns
The link's target, or ‘nil’ if the file at path ‘aPath’ doesn't exist, or isn't a link.

◆ typeOfFileAtPath:

- (FMFileType) typeOfFileAtPath: (NSString *) aPath

Queries the file type at path ‘aPath’.

Returns
The file's type if the file is found, or -1 if it isn't.

The documentation for this class was generated from the following files: