@@ -96,11 +96,11 @@ private class ApiManifest {
9696 }
9797
9898 private class Asset {
99- public File file ;
99+ public String filePath ;
100100 public String hash ;
101101
102- public Asset (File file , String hash ) {
103- this .file = file ;
102+ public Asset (String filePath , String hash ) {
103+ this .filePath = filePath ;
104104 this .hash = hash ;
105105 }
106106 }
@@ -127,7 +127,7 @@ public interface Callback {
127127 Assets (Project project ) {
128128 this .app = Snabble .getInstance ().getApplication ();
129129 this .project = project ;
130- this .manifestFile = new File (project .getInternalStorageDirectory (), "assets .json" );
130+ this .manifestFile = new File (project .getInternalStorageDirectory (), "assets_v2 .json" );
131131 this .assetDir = new File (project .getInternalStorageDirectory (), "assets/" );
132132 this .assetDir .mkdirs ();
133133
@@ -280,7 +280,7 @@ private void downloadAssets(Project project, ApiManifest apiManifest, String non
280280
281281 Logger .d ("add " + apiAsset .name );
282282
283- Asset asset = new Asset (localFile , hash );
283+ Asset asset = new Asset (localFile . getAbsolutePath () , hash );
284284 IOUtils .copy (body .byteStream (), new FileOutputStream (localFile ));
285285
286286 Dispatch .mainThread (() -> {
@@ -303,7 +303,8 @@ private void downloadAssets(Project project, ApiManifest apiManifest, String non
303303 if (!hashes .contains (asset .hash )) {
304304 Logger .d ("remove " + entry .getKey ());
305305
306- asset .file .delete ();
306+ File file = new File (asset .filePath );
307+ file .delete ();
307308 removals .add (entry .getKey ());
308309 }
309310 }
@@ -414,7 +415,7 @@ private Bitmap getBitmapByType(String name, Type type) {
414415 if (asset != null ) {
415416 try {
416417 Logger .d ("render %s %s/%s" , type .name (), project .getId (), name );
417- return BitmapFactory .decodeStream (new FileInputStream (asset .file ));
418+ return BitmapFactory .decodeStream (new FileInputStream (asset .filePath ));
418419 } catch (Exception e ) {
419420 Logger .d ("could not decode " + name + ": " + e .toString ());
420421 return null ;
@@ -433,7 +434,7 @@ private Bitmap getBitmapSVG(String name) {
433434 Resources res = app .getResources ();
434435 DisplayMetrics dm = res .getDisplayMetrics ();
435436
436- SVG svg = SVG .getFromInputStream (new FileInputStream (asset .file ));
437+ SVG svg = SVG .getFromInputStream (new FileInputStream (asset .filePath ));
437438 int width = Math .round (svg .getDocumentWidth () * dm .density );
438439 int height = Math .round (svg .getDocumentHeight () * dm .density );
439440
0 commit comments