Inherits from NSObject
Declared in DBFilesystem.h

Overview

The filesystem object provides a files and folder view of a user’s Dropbox. The most basic operations are listing a folder and opening a file, but it also allows you to move, delete, and create files and folders.

Tasks

Creating a filesystem object

Getting file information

Operations

Getting the current state

  •   account

    The account object this filesystem was created with.

    property
  •   completedFirstSync

    When a user’s account is first linked, the filesystem needs to be synced with the server before it can be used. This property indicates whether the first sync has completed and the filesystem is ready to use.

    property
  •   shutDown

    Whether the filesystem is currently shut down. The filesystem will shut down if the account associated with this filesystem becomes unlinked.

    property
  •   status

    Returns a bitmask representing all the currently active states of the filesystem OR'ed together. See the DBSyncStatus enum for more details.

    property

Watching for changes

Properties

account

The account object this filesystem was created with.

@property (nonatomic, readonly) DBAccount *account

Declared In

DBFilesystem.h

completedFirstSync

When a user’s account is first linked, the filesystem needs to be synced with the server before it can be used. This property indicates whether the first sync has completed and the filesystem is ready to use.

@property (nonatomic, readonly) BOOL completedFirstSync

Declared In

DBFilesystem.h

shutDown

Whether the filesystem is currently shut down. The filesystem will shut down if the account associated with this filesystem becomes unlinked.

@property (nonatomic, readonly, getter=isShutDown) BOOL shutDown

Declared In

DBFilesystem.h

status

Returns a bitmask representing all the currently active states of the filesystem OR'ed together. See the DBSyncStatus enum for more details.

@property (nonatomic, readonly) DBSyncStatus status

Declared In

DBFilesystem.h

Class Methods

setSharedFilesystem:

A convienent place to store your app’s filesystem

+ (void)setSharedFilesystem:(DBFilesystem *)filesystem

Declared In

DBFilesystem.h

sharedFilesystem

A convienent place to get your app’s filesystem

+ (DBFilesystem *)sharedFilesystem

Declared In

DBFilesystem.h

Instance Methods

addObserver:forPath:block:

Add an observer to be notified any time the file or folder at path changes.

- (BOOL)addObserver:(id)observer forPath:(DBPath *)path block:(DBObserver)block

Declared In

DBFilesystem.h

addObserver:forPathAndChildren:block:

Add an observer to be notified any time the folder at path changes or a file or folder directly contained in path changes.

- (BOOL)addObserver:(id)observer forPathAndChildren:(DBPath *)path block:(DBObserver)block

Declared In

DBFilesystem.h

addObserver:forPathAndDescendants:block:

Add an observer to be notified any time the folder at path changes or a file or folder contained somewhere beneath path changes.

- (BOOL)addObserver:(id)observer forPathAndDescendants:(DBPath *)path block:(DBObserver)block

Declared In

DBFilesystem.h

createFile:error:

Creates a new file at path and returns a file object open at that path.

- (DBFile *)createFile:(DBPath *)path error:(DBError **)error

Return Value

The newly created file object if the file was opened successfuly, or nil if an error occurred.

Declared In

DBFilesystem.h

createFolder:error:

Creates a new folder at path.

- (BOOL)createFolder:(DBPath *)path error:(DBError **)error

Return Value

YES if the folder was created successfully, or NO if an error occurred.

Declared In

DBFilesystem.h

deletePath:error:

Deletes the file or folder at path.

- (BOOL)deletePath:(DBPath *)path error:(DBError **)error

Return Value

YES if the file or folder was deleted successfully, or NO if an error occurred.

Declared In

DBFilesystem.h

fileInfoForPath:error:

Returns the file info for the file or folder at path.

- (DBFileInfo *)fileInfoForPath:(DBPath *)path error:(DBError **)error

Declared In

DBFilesystem.h

initWithAccount:

Create a new filesystem object with a linked account from the account manager.

- (id)initWithAccount:(DBAccount *)account

Declared In

DBFilesystem.h

listFolder:error:

Returns a list of DBFileInfo objects representing the files contained in the folder at path. If completedFirstSync is false, then this call will block until the first sync completes or an error occurs.

- (NSArray *)listFolder:(DBPath *)path error:(DBError **)error

Return Value

An array of DBFileInfo objects if successful, or nil if an error occurred.

Declared In

DBFilesystem.h

movePath:toPath:error:

Moves a file or folder at fromPath to toPath.

- (BOOL)movePath:(DBPath *)fromPath toPath:(DBPath *)toPath error:(DBError **)error

Return Value

YES if the file or folder was moved successfully, or NO if an error occurred.

Declared In

DBFilesystem.h

openFile:error:

Opens an existing file and returns a file object representing the file at path.

- (DBFile *)openFile:(DBPath *)path error:(DBError **)error

Return Value

The file object if the file was opened successfully, or nil if an error occurred.

Discussion

Files are opened at the newest cached version if the file is cached. Otherwise, the file will open at the latest server version and start downloading. Check the status property of the returned file object to determine whether it’s cached. Only 1 file can be open at a given path at the same time.

Declared In

DBFilesystem.h

removeObserver:

Unregister all blocks associated with observer from receiving updates.

- (void)removeObserver:(id)observer

Declared In

DBFilesystem.h