Brand the fork as Hellion Chat with independent plugin state
Switch the assembly name to HellionChat so Dalamud uses pluginConfigs/HellionChat for our config file and database directory, instead of sharing those locations with the upstream Chat 2 plugin. Code namespace stays ChatTwo.* so upstream cherry-picks apply cleanly. Rename the DalamudPackager manifest to HellionChat.yaml with fork-specific name, author, repo URL, description, tags and changelog. Plugin.PluginName becomes "Hellion Chat". Add a one-shot migration in the plugin constructor that runs before GetPluginConfig: if pluginConfigs/ChatTwo.json or the ChatTwo/ directory exist and our equivalents don't, move them into the HellionChat layout. Idempotent: only fires on the first load where legacy paths are present and ours are not.
This commit is contained in:
+37
-1
@@ -19,7 +19,7 @@ namespace ChatTwo;
|
||||
// ReSharper disable once ClassNeverInstantiated.Global
|
||||
public sealed class Plugin : IDalamudPlugin
|
||||
{
|
||||
public const string PluginName = "Chat 2";
|
||||
public const string PluginName = "Hellion Chat";
|
||||
|
||||
[PluginService] public static IPluginLog Log { get; private set; } = null!;
|
||||
[PluginService] public static IDalamudPluginInterface Interface { get; private set; } = null!;
|
||||
@@ -86,6 +86,11 @@ public sealed class Plugin : IDalamudPlugin
|
||||
{
|
||||
GameStarted = Process.GetCurrentProcess().StartTime.ToUniversalTime();
|
||||
|
||||
// Hellion Chat: take over config + database from upstream ChatTwo
|
||||
// before Dalamud loads our plugin config. Idempotent: only acts on
|
||||
// the first start where the legacy paths exist and ours don't.
|
||||
MigrateFromChatTwoLayout();
|
||||
|
||||
Config = Interface.GetPluginConfig() as Configuration ?? new Configuration();
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
@@ -241,6 +246,37 @@ public sealed class Plugin : IDalamudPlugin
|
||||
ServerCore?.DisposeAsync().AsTask().Wait();
|
||||
}
|
||||
|
||||
private static void MigrateFromChatTwoLayout()
|
||||
{
|
||||
try
|
||||
{
|
||||
var pluginConfigsDir = Interface.ConfigDirectory.Parent?.FullName;
|
||||
if (pluginConfigsDir is null)
|
||||
return;
|
||||
|
||||
var legacyConfigFile = Path.Combine(pluginConfigsDir, "ChatTwo.json");
|
||||
var legacyConfigDir = Path.Combine(pluginConfigsDir, "ChatTwo");
|
||||
var ourConfigFile = Path.Combine(pluginConfigsDir, "HellionChat.json");
|
||||
var ourConfigDir = Interface.ConfigDirectory.FullName;
|
||||
|
||||
if (!File.Exists(ourConfigFile) && File.Exists(legacyConfigFile))
|
||||
{
|
||||
File.Move(legacyConfigFile, ourConfigFile);
|
||||
Log.Information($"HellionChat: migrated config file {legacyConfigFile} → {ourConfigFile}");
|
||||
}
|
||||
|
||||
if (!Directory.Exists(ourConfigDir) && Directory.Exists(legacyConfigDir))
|
||||
{
|
||||
Directory.Move(legacyConfigDir, ourConfigDir);
|
||||
Log.Information($"HellionChat: migrated config dir {legacyConfigDir} → {ourConfigDir}");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e, "HellionChat: layout migration failed, continuing with whatever exists");
|
||||
}
|
||||
}
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
ChatLogWindow.BeginFrame();
|
||||
|
||||
Reference in New Issue
Block a user