refactor: reorganize engine-based structure and add agent rules
- Engines/ 配下へエンジン別に再編 (Common/Rgss/Tkool/Tyrano/Wolf/Unity/Nwjs) - ゲーム個別処理を Engines/<Engine>/Games/<GameName>/ へ分離し、共通処理から明示呼び出し - 外部ツールを Engines/<Engine>/Tools/ へ移動し、AppPathHelper 経由で解決 - 旧 Tools/ 直下参照と不要な参照ファイル/バックアップを削除 - エージェント規則 AGENTS.md を追加し、README から参照 - publish.ps1 を Engines/<Engine>/Tools/ の再帰配置に対応
This commit is contained in:
1 parent
0d11039ee9
commit
8cea2a147d
47 files changed
+2976
-176
No files matched your search
@@ -273,5 +273,78 @@ namespace GameLauncher.Helpers
|
||||
CopyDirectory(sub, destSub);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the engine-specific tools directory, e.g. "Engines/Wolf/Tools".
|
||||
/// External tools are grouped per engine so that each engine only references
|
||||
/// its own tools and never depends on another engine's files.
|
||||
/// </summary>
|
||||
/// <param name="engineName">Engine identifier ("Rgss", "Wolf", "Nwjs", ...).</param>
|
||||
/// <returns>Absolute path to the engine tools directory (created when possible).</returns>
|
||||
public static string GetEngineToolsDirectory(string engineName)
|
||||
{
|
||||
var safeEngine = string.IsNullOrWhiteSpace(engineName) ? "Common" : engineName.Trim();
|
||||
var path = Path.Combine(GetExeDirectory(), "Engines", safeEngine, "Tools");
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return path;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolves an engine-specific external tool file path.
|
||||
/// Searches the deployed location, the production folder, and the source
|
||||
/// tree fallback, returning the first existing candidate or null.
|
||||
/// </summary>
|
||||
/// <param name="engineName">Engine identifier ("Rgss", "Wolf", "Nwjs", ...).</param>
|
||||
/// <param name="toolFileName">Tool file name (e.g. "UberWolfCli.exe").</param>
|
||||
/// <returns>Absolute path to the tool, or null if not found.</returns>
|
||||
public static string? ResolveEngineTool(string engineName, string toolFileName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(engineName) || string.IsNullOrWhiteSpace(toolFileName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var safeEngine = engineName.Trim();
|
||||
var exeDir = GetExeDirectory();
|
||||
var candidates = new[]
|
||||
{
|
||||
Path.Combine(exeDir, "Engines", safeEngine, "Tools", toolFileName),
|
||||
Path.Combine(AppContext.BaseDirectory, "Engines", safeEngine, "Tools", toolFileName),
|
||||
Path.Combine(exeDir, "Engines", safeEngine, "Tools"),
|
||||
};
|
||||
|
||||
// First two candidates are full file paths; check those directly.
|
||||
for (var i = 0; i < 2; i++)
|
||||
{
|
||||
if (File.Exists(candidates[i]))
|
||||
{
|
||||
return candidates[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Fallbacks for development-time source layout.
|
||||
var devFallbacks = new[]
|
||||
{
|
||||
$@"C:\VS2026\GameLauncher\Engines\{safeEngine}\Tools\{toolFileName}",
|
||||
$@"Z:\自作ソフト\GameLauncher\Engines\{safeEngine}\Tools\{toolFileName}",
|
||||
};
|
||||
|
||||
foreach (var candidate in devFallbacks)
|
||||
{
|
||||
if (File.Exists(candidate))
|
||||
{
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using GameLauncher.Models;
|
||||
using GameLauncher.Engines.Tkool;
|
||||
using GameLauncher.Engines.Unity;
|
||||
|
||||
namespace GameLauncher.Helpers
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user