@@ -252,7 +252,7 @@ class Paths
252252
253253 inline static public function sound (key : String , ? library : String ): Null <Sound >
254254 {
255- return returnSound (' sounds' , key , library );
255+ return returnFolderSound (' sounds' , key , library );
256256 }
257257
258258 inline static public function soundRandom (key : String , min : Int , max : Int , ? library : String )
@@ -262,12 +262,12 @@ class Paths
262262
263263 inline static public function music (key : String , ? library : String ): Null <Sound >
264264 {
265- return returnSound (' music' , key , library );
265+ return returnFolderSound (' music' , key , library );
266266 }
267267
268268 inline static public function track (song : String , track : String ): Null <Sound >
269269 {
270- return returnSound (' songs' , ' ${formatToSongPath (song )}/ $track ' );
270+ return returnFolderSound (' songs' , ' ${formatToSongPath (song )}/ $track ' );
271271 }
272272
273273 inline static public function voices (song : String ): Null <Sound >
@@ -528,29 +528,30 @@ class Paths
528528 return getPath (' $path / $key . $SOUND_EXT ' );
529529 }
530530
531- public static function returnSound (path : String , key : String , ? library : String )
532- {
533- var gottenPath : String = soundPath (path , key , library );
534-
535- if (currentTrackedSounds .exists (gottenPath )) {
536- if (! localTrackedAssets .contains (gottenPath ))
537- localTrackedAssets .push (gottenPath );
531+ inline public static function returnFolderSound (path : String , key : String , ? library : String )
532+ return returnSound (soundPath (path , key , library ), library );
538533
539- return currentTrackedSounds .get (gottenPath );
534+ public static function returnSound (path : String , ? library : String )
535+ {
536+ if (currentTrackedSounds .exists (path )) {
537+ if (! localTrackedAssets .contains (path ))
538+ localTrackedAssets .push (path );
539+
540+ return currentTrackedSounds .get (path );
540541 }
541542
542- var sound = getSound (gottenPath );
543+ var sound = getSound (path );
543544 if (sound != null ) {
544- currentTrackedSounds .set (gottenPath , sound );
545+ currentTrackedSounds .set (path , sound );
545546
546- if (! localTrackedAssets .contains (gottenPath ))
547- localTrackedAssets .push (gottenPath );
547+ if (! localTrackedAssets .contains (path ))
548+ localTrackedAssets .push (path );
548549
549550 return sound ;
550551 }
551552
552553 if (Main .showDebugTraces )
553- trace (' sound $path , $ key => $ gottenPath returned null' );
554+ trace (' sound $path returned null' );
554555
555556 return null ;
556557 }
@@ -571,6 +572,9 @@ class Paths
571572 return null ;
572573 }
573574
575+ public static inline function getFolderPath (folder : String = " " ): String
576+ return (folder == " " ) ? getPreloadPath () : mods (folder );
577+
574578 // //
575579 public static var currentModDirectory (default , set ): String = ' ' ;
576580 static function set_currentModDirectory (v : String ){
0 commit comments