Native Client

PPB_FileRef Struct Reference

The PPB_FileRef struct represents a "weak pointer" to a file in a file system. More...


Detailed Description

The PPB_FileRef struct represents a "weak pointer" to a file in a file system.

This struct contains a PP_FileSystemType identifier and a file path string.

Data Fields List

PP_Resource(* Create )(PP_Resource file_system, const char *path)
PP_Bool(* IsFileRef )(PP_Resource resource)
PP_FileSystemType(* GetFileSystemType )(PP_Resource file_ref)
struct PP_Var(* GetName )(PP_Resource file_ref)
struct PP_Var(* GetPath )(PP_Resource file_ref)
PP_Resource(* GetParent )(PP_Resource file_ref)
int32_t(* MakeDirectory )(PP_Resource directory_ref, PP_Bool make_ancestors, struct PP_CompletionCallback callback)
int32_t(* Touch )(PP_Resource file_ref, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback)
int32_t(* Delete )(PP_Resource file_ref, struct PP_CompletionCallback callback)
int32_t(* Rename )(PP_Resource file_ref, PP_Resource new_file_ref, struct PP_CompletionCallback callback)

Data Fields Details

PP_Resource(* PPB_FileRef::Create)(PP_Resource file_system, const char *path)

Create() creates a weak pointer to a file in the given file system.

File paths are POSIX style.

Parameters:
[in]resourceA PP_Resource corresponding to a file system.
[in]pathA path to the file.
Returns:
A PP_Resource corresponding to a file reference if successful or 0 if the path is malformed.
int32_t(* PPB_FileRef::Delete)(PP_Resource file_ref, struct PP_CompletionCallback callback)

Delete() deletes a file or directory.

If file_ref refers to a directory, then the directory must be empty. It is an error to delete a file or directory that is in use. It is not valid to delete a file in the external file system.

Parameters:
[in]file_refA PP_Resource corresponding to a file reference.
[in]callbackA PP_CompletionCallback to be called upon completion of Delete().
Returns:
An int32_t containing an error code from pp_errors.h.

GetFileSystemType() returns the type of the file system.

Parameters:
[in]file_refA PP_Resource corresponding to a file reference.
Returns:
A PP_FileSystemType with the file system type if valid or PP_FILESYSTEMTYPE_INVALID if the provided resource is not a valid file reference.
struct PP_Var(* PPB_FileRef::GetName)(PP_Resource file_ref) [read]

GetName() returns the name of the file.

Parameters:
[in]file_refA PP_Resource corresponding to a file reference.
Returns:
A PP_Var containing the name of the file. The value returned by this function does not include any path components (such as the name of the parent directory, for example). It is just the name of the file. Use GetPath() to get the full file path.

GetParent() returns the parent directory of this file.

If file_ref points to the root of the filesystem, then the root is returned.

Parameters:
[in]file_refA PP_Resource corresponding to a file reference.
Returns:
A PP_Resource containing the parent directory of the file. This function fails if the file system type is PP_FileSystemType_External.
struct PP_Var(* PPB_FileRef::GetPath)(PP_Resource file_ref) [read]

GetPath() returns the absolute path of the file.

Parameters:
[in]file_refA PP_Resource corresponding to a file reference.
Returns:
A PP_Var containing the absolute path of the file. This function fails if the file system type is PP_FileSystemType_External.

IsFileRef() determines if the provided resource is a file reference.

Parameters:
[in]resourceA PP_Resource corresponding to a file reference.
Returns:
PP_TRUE if the resource is a PPB_FileRef, PP_FALSE if the resource is invalid or some type other than PPB_FileRef.
int32_t(* PPB_FileRef::MakeDirectory)(PP_Resource directory_ref, PP_Bool make_ancestors, struct PP_CompletionCallback callback)

MakeDirectory() makes a new directory in the file system as well as any parent directories if the make_ancestors argument is PP_TRUE.

It is not valid to make a directory in the external file system.

Parameters:
[in]file_refA PP_Resource corresponding to a file reference.
[in]make_ancestorsA PP_Bool set to PP_TRUE to make ancestor directories or PP_FALSE if ancestor directories are not needed.
Returns:
An int32_t containing an error code from pp_errors.h. Fails if the directory already exists or if ancestor directories do not exist and make_ancestors was not passed as PP_TRUE.
int32_t(* PPB_FileRef::Rename)(PP_Resource file_ref, PP_Resource new_file_ref, struct PP_CompletionCallback callback)

Rename() renames a file or directory.

Arguments file_ref and new_file_ref must both refer to files in the same file system. It is an error to rename a file or directory that is in use. It is not valid to rename a file in the external file system.

Parameters:
[in]file_refA PP_Resource corresponding to a file reference.
[in]new_file_refA PP_Resource corresponding to a new file reference.
[in]callbackA PP_CompletionCallback to be called upon completion of Rename().
Returns:
An int32_t containing an error code from pp_errors.h.
int32_t(* PPB_FileRef::Touch)(PP_Resource file_ref, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback)

Touch() Updates time stamps for a file.

You must have write access to the file if it exists in the external filesystem.

Parameters:
[in]file_refA PP_Resource corresponding to a file reference.
[in]last_access_timeThe last time the file was accessed.
[in]last_modified_timeThe last time the file was modified.
[in]callbackA PP_CompletionCallback to be called upon completion of Touch().
Returns:
An int32_t containing an error code from pp_errors.h.

The documentation for this struct was generated from the following file:

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.