using System; using System.IO; using Godot; using RustToDust.Core; namespace RustToDust.Client; internal static class ClientAssets { private static bool _registered; internal static void EnsureAssetsRootRegistered() { if (_registered) { return; } _registered = true; if (OS.HasFeature("template")) { string exeAssets = Path.Combine(OS.GetExecutablePath().GetBaseDir(), "assets"); if (Directory.Exists(exeAssets)) { AssetPathResolver.RegisterAssetsRoot(exeAssets); return; } } string baseAssets = Path.Combine(AppContext.BaseDirectory, "assets"); if (Directory.Exists(baseAssets)) { AssetPathResolver.RegisterAssetsRoot(baseAssets); } } internal static string LocateAssetsDirectory() { EnsureAssetsRootRegistered(); return AssetPathResolver.LocateAssetsRoot(); } }