SuperTuxKart
assets_android.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2014-2015 SuperTuxKart-Team
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 3
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 
18 #ifndef HEADER_ASSETS_ANDROID_HPP
19 #define HEADER_ASSETS_ANDROID_HPP
20 
21 #include <string>
22 
23 class FileManager;
24 
26 {
27 private:
28  FileManager* m_file_manager;
29  std::string m_stk_dir;
30 
31  void extractData();
32  bool extractFile(std::string file_name);
33  void removeData();
34  bool hasAssets();
35  void touchFile(std::string path);
36  bool isWritable(std::string path);
37  std::string getPreferredPath(const std::vector<std::string>& paths);
38  void setProgressBar(int progress);
39 public:
40  AssetsAndroid(FileManager* file_manager);
41  ~AssetsAndroid() {};
42 
43  void init();
44  static std::string getDataPath();
45 };
46 
47 
48 #endif
Definition: assets_android.hpp:26
AssetsAndroid(FileManager *file_manager)
Assets Android constructor.
Definition: assets_android.cpp:36
bool isWritable(std::string path)
Checks if there is write access for selected path.
Definition: assets_android.cpp:590
static std::string getDataPath()
Get a path for internal data directory.
Definition: assets_android.cpp:651
void extractData()
A function that extracts whole data directory from apk file to a real path in the filesystem.
Definition: assets_android.cpp:252
void init()
A function that detects a path where data directory is placed and that sets some environment variable...
Definition: assets_android.cpp:46
void removeData()
A function that removes whole STK data directory.
Definition: assets_android.cpp:469
bool extractFile(std::string file_name)
A function that extracts selected file or directory from apk file.
Definition: assets_android.cpp:388
std::string getPreferredPath(const std::vector< std::string > &paths)
Determines best path for extracting assets, depending on available disk space.
Definition: assets_android.cpp:605
bool hasAssets()
A function that checks if assets are included in the package.
Definition: assets_android.cpp:544
void touchFile(std::string path)
A function that creates empty file.
Definition: assets_android.cpp:567
void setProgressBar(int progress)
A function set progress bar using java JNI.
Definition: assets_android.cpp:338
class handling files and paths
Definition: file_manager.hpp:59