ProjectManager  0.2
Public Member Functions | Protected Attributes
FileManager Class Reference
Inheritance diagram for FileManager:
<ProjectModule>

List of all members.

Public Member Functions

(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:

Protected Attributes

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

Member Function Documentation

- (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.
- (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.
- (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.
- (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.
- (BOOL) fileExistsAtPath: (NSString *)  aPath

Determines whether a file exists at `aPath'.

Returns:
YES if the file exists, otherwise NO.
- (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.

Referenced by measureDiskUsageAtPath:, and removePath:delete:error:.

- (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.

- (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.

Referenced by importFile:toPath:link: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.

References targetOfLinkAtPath:.

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

Measures the disk usage of files at and under path `aPath'.

Returns:
The disk usage in bytes.

References filesAtPath:, and measureDiskUsageAtPath:.

Referenced by measureDiskUsageAtPath:.

- (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.
- (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.

References ProjectDocument::openFile:inCodeEditorOnLine:, and targetOfLinkAtPath:.

- (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.
- (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.

References containingCategory, and <ProjectModule>::document.

- (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.

References filesAtPath:.

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.

Referenced by iconForPath:, linkPath:fromPath:error:, and openPath:.

- (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: