@@ -121,6 +121,7 @@ Java_at_tomtasche_reader_background_CoreWrapper_parseNative(JNIEnv *env, jclass
121121 jboolean editable = env->GetBooleanField (options, editableField);
122122
123123 std::string outputPathCpp = getStringField (env, optionsClass, options, " outputPath" );
124+ std::string cachePathCpp = getStringField (env, optionsClass, options, " cachePath" );
124125
125126 jclass listClass = env->FindClass (" java/util/List" );
126127 jmethodID addMethod = env->GetMethodID (listClass, " add" , " (Ljava/lang/Object;)Z" );
@@ -195,11 +196,11 @@ Java_at_tomtasche_reader_background_CoreWrapper_parseNative(JNIEnv *env, jclass
195196
196197 __android_log_print (ANDROID_LOG_VERBOSE, " smn" , " Translate to HTML" );
197198
198- std::string output_tmp = outputPathCpp + " /tmp " ;
199- std::filesystem::create_directories (output_tmp );
200- odr::HtmlService service = odr::html::translate (file, output_tmp , htmlConfig, logger);
199+ std::filesystem::remove_all (cachePathCpp) ;
200+ std::filesystem::create_directories (cachePathCpp );
201+ odr::HtmlService service = odr::html::translate (file, cachePathCpp , htmlConfig, logger);
201202 odr::Html html = service.bring_offline (outputPathCpp);
202- std::filesystem::remove_all (output_tmp );
203+ std::filesystem::remove_all (cachePathCpp );
203204
204205 for (const odr::HtmlPage &page: html.pages ()) {
205206 jstring pageName = env->NewStringUTF (page.name .c_str ());
@@ -350,6 +351,7 @@ Java_at_tomtasche_reader_background_CoreWrapper_hostFileNative(JNIEnv *env, jcla
350351 jboolean editable = env->GetBooleanField (options, editableField);
351352
352353 std::string outputPathCpp = getStringField (env, optionsClass, options, " outputPath" );
354+ std::string cachePathCpp = getStringField (env, optionsClass, options, " cachePath" );
353355
354356 jclass listClass = env->FindClass (" java/util/List" );
355357 jmethodID addMethod = env->GetMethodID (listClass, " add" , " (Ljava/lang/Object;)Z" );
@@ -395,9 +397,9 @@ Java_at_tomtasche_reader_background_CoreWrapper_hostFileNative(JNIEnv *env, jcla
395397 htmlConfig.text_document_margin = paging;
396398 htmlConfig.editable = editable;
397399
398- std::string output_tmp = outputPathCpp + " /tmp " ;
399- std::filesystem::create_directories (output_tmp );
400- odr::HtmlService service = odr::html::translate (file, output_tmp , htmlConfig, logger);
400+ std::filesystem::remove_all (cachePathCpp) ;
401+ std::filesystem::create_directories (cachePathCpp );
402+ odr::HtmlService service = odr::html::translate (file, cachePathCpp , htmlConfig, logger);
401403 s_server->connect_service (service, prefixCpp);
402404 odr::HtmlViews htmlViews = service.list_views ();
403405
0 commit comments