SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
AssetsAndroid Class Reference

Public Member Functions

 AssetsAndroid (FileManager *file_manager)
 Assets Android constructor.
 
void init ()
 A function that detects a path where data directory is placed and that sets some environment variables that are used for finding data and home directory in a common code.
 

Static Public Member Functions

static std::string getDataPath ()
 Get a path for internal data directory.
 

Private Member Functions

void extractData ()
 A function that extracts whole data directory from apk file to a real path in the filesystem.
 
bool extractFile (std::string file_name)
 A function that extracts selected file or directory from apk file.
 
void removeData ()
 A function that removes whole STK data directory.
 
bool hasAssets ()
 A function that checks if assets are included in the package.
 
void touchFile (std::string path)
 A function that creates empty file.
 
bool isWritable (std::string path)
 Checks if there is write access for selected path.
 
std::string getPreferredPath (const std::vector< std::string > &paths)
 Determines best path for extracting assets, depending on available disk space.
 
void setProgressBar (int progress)
 A function set progress bar using java JNI.
 

Private Attributes

FileManagerm_file_manager
 
std::string m_stk_dir
 

Member Function Documentation

◆ extractFile()

bool AssetsAndroid::extractFile ( std::string  filename)
private

A function that extracts selected file or directory from apk file.

Parameters
dir_nameDirectory to extract from assets
Returns
True if successfully extracted

◆ getDataPath()

std::string AssetsAndroid::getDataPath ( )
static

Get a path for internal data directory.

Returns
Path for internal data directory or empty string when failed

◆ getPreferredPath()

std::string AssetsAndroid::getPreferredPath ( const std::vector< std::string > &  paths)
private

Determines best path for extracting assets, depending on available disk space.

Parameters
pathsA list of paths that should be checked
Returns
Best path or empty string in case of error

◆ hasAssets()

bool AssetsAndroid::hasAssets ( )
private

A function that checks if assets are included in the package.

Returns
true if apk has assets

◆ isWritable()

bool AssetsAndroid::isWritable ( std::string  path)
private

Checks if there is write access for selected path.

Parameters
pathA path that should be checked
Returns
True if there is write access

◆ setProgressBar()

void AssetsAndroid::setProgressBar ( int  progress)
private

A function set progress bar using java JNI.

Parameters
progressprogress 0-100

◆ touchFile()

void AssetsAndroid::touchFile ( std::string  path)
private

A function that creates empty file.

Parameters
pathA path to the file that should be created

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