see the mods folder wasnt gone for too long

This commit is contained in:
ILikeWeewees 2023-06-02 19:43:07 -07:00
parent 80ad67e459
commit a353fc7ae8
2 changed files with 13 additions and 4 deletions

View File

@ -96,7 +96,7 @@
<assets path="assets/week7" library="week7" exclude="*.fla|*.ogg" if="web"/>
<assets path="assets/week7" library="week7" exclude="*.fla|*.mp3" unless="web"/>
<!-- <assets path='example_mods' rename='mods' embed='false'/> -->
<assets path='example_mods' rename='mods' embed='false'/>
<!-- <template path="example_mods" rename="mods" /> -->

View File

@ -4,6 +4,7 @@ import flixel.FlxG;
import flixel.graphics.frames.FlxAtlasFrames;
import openfl.utils.AssetType;
import openfl.utils.Assets as OpenFlAssets;
import sys.FileSystem;
class Paths
{
@ -24,15 +25,23 @@ class Paths
if (currentLevel != null)
{
var levelPath = getLibraryPathForce(file, currentLevel);
if (OpenFlAssets.exists(levelPath, type))
if (OpenFlAssets.exists(levelPath, type) || FileSystem.exists(levelPath))
return levelPath;
levelPath = getLibraryPathForce(file, "shared");
if (OpenFlAssets.exists(levelPath, type))
if (OpenFlAssets.exists(levelPath, type) || FileSystem.exists(levelPath))
return levelPath;
}
return getPreloadPath(file);
var originalPath = getPreloadPath(file);
var modsPath = "mods/" + file;
if (OpenFlAssets.exists(originalPath, type) || FileSystem.exists(originalPath))
return originalPath;
else if (OpenFlAssets.exists(modsPath, type) || FileSystem.exists(modsPath))
return modsPath;
return null; // File not found in original or mods folder
}
static public function getLibraryPath(file:String, library = "preload")