this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

always use AssetRegistry to create Assets

+10 -10
+4 -4
src/main/java/assets/Asset.kt
··· 11 11 import kotlin.io.path.* 12 12 13 13 /** An asset on disk, but not yet loaded because it may be expensive to load. */ 14 - open class Asset( 14 + open class Asset internal constructor( 15 15 val root: Path, 16 16 var relativePath: Path, 17 17 ) { ··· 21 21 } 22 22 } 23 23 24 - constructor(root: Path, relativePath: String) : this(root, Path(relativePath)) 25 - constructor(root: File, relativePath: String) : this(root.toPath(), relativePath) 26 - constructor(other: Asset) : this(other.root, other.relativePath) 24 + internal constructor(root: Path, relativePath: String) : this(root, Path(relativePath)) 25 + internal constructor(root: File, relativePath: String) : this(root.toPath(), relativePath) 26 + internal constructor(other: Asset) : this(other.root, other.relativePath) 27 27 28 28 /** Full path on disk. May be a directory. */ 29 29 var path: Path
+6 -6
src/main/java/assets/AssetManager.java
··· 39 39 public static Asset get(AssetSubdir subdir, String path) 40 40 { 41 41 for (File assetDir : Environment.assetDirectories) { 42 - Asset ah = new Asset(assetDir, subdir + path); 42 + Asset ah = AssetRegistry.getInstance().create(assetDir.toPath(), java.nio.file.Path.of(subdir + path)); 43 43 44 44 if (ah.exists()) 45 45 return ah; 46 46 } 47 - return new Asset(AssetManager.getTopLevelAssetDir(), subdir + path); 47 + return AssetRegistry.getInstance().create(AssetManager.getTopLevelAssetDir().toPath(), java.nio.file.Path.of(subdir + path)); 48 48 } 49 49 50 50 public static Asset getTopLevel(Asset source) 51 51 { 52 - return new Asset(getTopLevelAssetDir(), source.getRelativePath().toString()); 52 + return AssetRegistry.getInstance().create(getTopLevelAssetDir().toPath(), source.getRelativePath()); 53 53 } 54 54 55 55 public static Asset getBase(AssetSubdir subdir, String path) 56 56 { 57 - return new Asset(getBaseAssetDir(), subdir + path); 57 + return AssetRegistry.getInstance().create(getBaseAssetDir().toPath(), java.nio.file.Path.of(subdir + path)); 58 58 } 59 59 60 60 /** ··· 229 229 continue; 230 230 231 231 String relPath = dir + subdir + filename; 232 - Asset ah = new Asset(stackDir, relPath); 232 + Asset ah = AssetRegistry.getInstance().create(stackDir.toPath(), java.nio.file.Path.of(relPath)); 233 233 234 234 // only add first occurance down the asset stack traversal 235 235 assetMap.putIfAbsent(filename, ah); ··· 334 334 continue; 335 335 } 336 336 337 - Asset ah = new Asset(assetDir, AssetSubdir.ICON + relativeString); 337 + Asset ah = AssetRegistry.getInstance().create(assetDir.toPath(), java.nio.file.Path.of(AssetSubdir.ICON + relativeString)); 338 338 if (!assetMap.containsKey(relativeString)) { 339 339 assetMap.put(relativeString, ah); 340 340 }