Starboard Module Reference: directory.h

Provides directory listing functions.

Structs

SbDirectoryEntry

Represents a directory entry.

Members

Members
char
name[SB_FILE_MAX_NAME]
The name of this directory entry.

SbDirectory

A handle to an open directory stream.

Functions

SbDirectoryCanOpen

Description

Indicates whether SbDirectoryOpen is allowed for the given path.

Declaration and definitions

SB_EXPORT bool SbDirectoryCanOpen(const char* path);

#include "starboard/directory.h"

bool SbDirectoryCanOpen(const char* /*path*/) {
  return false;
}

Parameters

Parameters
const char*
path
The path to be checked.

SbDirectoryClose

Description

Closes an open directory stream handle. The return value indicates whether the directory was closed successfully.

Declaration and definitions

SB_EXPORT bool SbDirectoryClose(SbDirectory directory);

#include "starboard/directory.h"

bool SbDirectoryClose(SbDirectory /*directory*/) {
  return false;
}

Parameters

Parameters
SbDirectory
directory
The directory stream handle to close.

SbDirectoryCreate

Description

Creates the directory path, assuming the parent directory already exists. This function returns true if the directory now exists (even if it existed before) and returns false if the directory does not exist.

Declaration and definitions

SB_EXPORT bool SbDirectoryCreate(const char* path);

#include "starboard/directory.h"

bool SbDirectoryCreate(const char* /*path*/) {
  return false;
}

Parameters

Parameters
const char*
path
The path to be created.

SbDirectoryGetNext

Description

Populates out_entry with the next entry in the specified directory stream, and moves the stream forward by one entry.
This function returns true if there was a next directory, and false at the end of the directory stream.

Declaration and definitions

SB_EXPORT bool SbDirectoryGetNext(SbDirectory directory,
                                  SbDirectoryEntry* out_entry);

#include "starboard/directory.h"

bool SbDirectoryGetNext(SbDirectory /*directory*/,
                        SbDirectoryEntry* /*out_entry*/) {
  return false;
}

Parameters

Parameters
SbDirectory
directory
The directory stream from which to retrieve the next directory.
SbDirectoryEntry*
out_entry
The variable to be populated with the next directory entry.

SbDirectoryIsValid

Description

Returns whether the given directory stream handle is valid.

Declaration

static SB_C_INLINE bool SbDirectoryIsValid(SbDirectory directory) {
  return directory != kSbDirectoryInvalid;
}

Parameters

Parameters
SbDirectory
directory

SbDirectoryOpen

Description

Opens the given existing directory for listing. This function returns kSbDirectoryInvalidHandle if it is not successful.
If out_error is provided by the caller, it will be set to the appropriate SbFileError code on failure.

Declaration and definitions

SB_EXPORT SbDirectory SbDirectoryOpen(const char* path, SbFileError* out_error);

#include "starboard/directory.h"

SbDirectory SbDirectoryOpen(const char* /*path*/, SbFileError* /*out_error*/) {
  return kSbDirectoryInvalid;
}

Parameters

Parameters
const char*
path
SbFileError*
out_error
An output parameter that, in case of an error, is set to the reason that the directory could not be opened.