summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/files.cpp19
-rw-r--r--src/utils/files.h4
2 files changed, 23 insertions, 0 deletions
diff --git a/src/utils/files.cpp b/src/utils/files.cpp
index 6f57d3062..bfaed472a 100644
--- a/src/utils/files.cpp
+++ b/src/utils/files.cpp
@@ -63,6 +63,18 @@ void Files::extractLocale()
#endif // ANDROID
#if defined(ANDROID) || defined(__native_client__)
+
+namespace
+{
+ int mFilesCount = 0;
+ Files::CopyFileCallbackPtr mCallbackPtr = nullptr;
+} // namespace
+
+void Files::setCopyCallBack(Files::CopyFileCallbackPtr callback)
+{
+ mCallbackPtr = callback;
+}
+
void Files::copyPhysFsFile(const std::string &inFile,
const std::string &outFile)
{
@@ -72,6 +84,13 @@ void Files::copyPhysFsFile(const std::string &inFile,
fwrite(buf, 1, size, file);
fclose(file);
free(buf);
+#ifdef ANDROID
+ if (mCallbackPtr)
+ {
+ mCallbackPtr(mFilesCount);
+ mFilesCount ++;
+ }
+#endif
}
void Files::copyPhysFsDir(const std::string &inDir, const std::string &outDir)
diff --git a/src/utils/files.h b/src/utils/files.h
index 735812563..f356d7688 100644
--- a/src/utils/files.h
+++ b/src/utils/files.h
@@ -30,6 +30,10 @@ namespace Files
#endif
#if defined(ANDROID) || defined(__native_client__)
+ typedef void (*CopyFileCallbackPtr) (int cnt);
+
+ void setCopyCallBack(CopyFileCallbackPtr callback);
+
void copyPhysFsFile(const std::string &inFile, const std::string &outFile);
void copyPhysFsDir(const std::string &inDir, const std::string &outDir);