From 12bcae137a5b35e0ad8017f71dc58d2b337094c7 Mon Sep 17 00:00:00 2001
From: Toastie <toastie@toastiet0ast.com>
Date: Wed, 29 Jan 2025 23:28:04 +1300
Subject: [PATCH] fixed references to stings, fixed tests

---
 src/EllieBot.Generators/README.md                      |  2 +-
 src/EllieBot.Tests/BotStringsTests.cs                  | 10 +++++-----
 src/EllieBot/EllieBot.csproj                           |  7 ++++++-
 src/EllieBot/_common/CommandNameLoadHelper.cs          |  4 ++--
 src/EllieBot/_common/Impl/Localization.cs              |  2 +-
 .../Services/strings/impl/LocalFileStringsSource.cs    |  8 ++++----
 src/EllieBot/{data => strings}/aliases.yml             |  0
 7 files changed, 19 insertions(+), 14 deletions(-)
 rename src/EllieBot/{data => strings}/aliases.yml (100%)

diff --git a/src/EllieBot.Generators/README.md b/src/EllieBot.Generators/README.md
index cfe1ea4..be609db 100644
--- a/src/EllieBot.Generators/README.md
+++ b/src/EllieBot.Generators/README.md
@@ -11,7 +11,7 @@ Project which contains source generators required for EllieBot project
     -- How it works --
     Creates a file "strs.cs" containing a class called "strs" in "EllieBot" namespace.
     
-    Loads "data/strings/responses.en-US.json" and creates a property or a function for each key in the responses json file based on whether the value has string format placeholders or not.
+    Loads "strings/responses.en-US.json" and creates a property or a function for each key in the responses json file based on whether the value has string format placeholders or not.
 
     - If a value has no placeholders, it creates a property in the strs class which returns an instance of a LocStr struct containing only the key and no replacement parameters
     
diff --git a/src/EllieBot.Tests/BotStringsTests.cs b/src/EllieBot.Tests/BotStringsTests.cs
index f1b9be7..d295c5a 100644
--- a/src/EllieBot.Tests/BotStringsTests.cs
+++ b/src/EllieBot.Tests/BotStringsTests.cs
@@ -11,9 +11,9 @@ namespace EllieBot.Tests
 {
     public class CommandStringsTests
     {
-        private const string responsesPath = "../../../../EllieBot/data/strings/responses";
-        private const string commandsPath = "../../../../EllieBot/data/strings/commands";
-        private const string aliasesPath = "../../../../EllieBot/data/aliases.yml";
+        private const string responsesPath = "../../../../EllieBot/strings/responses";
+        private const string commandsPath = "../../../../EllieBot/strings/commands";
+        private const string aliasesPath = "../../../../EllieBot/aliases.yml";
 
         [Test]
         public void AllCommandNamesHaveStrings()
@@ -96,7 +96,7 @@ namespace EllieBot.Tests
             if (isSuccess)
                 Assert.Pass();
             else
-                Assert.Warn("There are some unused entries in data/aliases.yml");
+                Assert.Warn("There are some unused entries in aliases.yml");
         }
 
         [Test]
@@ -123,7 +123,7 @@ namespace EllieBot.Tests
                 }
             }
 
-            Assert.That(isSuccess, Is.True, "There are some unused command strings in data/strings/commands.en-US.yml");
+            Assert.That(isSuccess, Is.True, "There are some unused command strings in strings/commands.en-US.yml");
         }
     }
 }
\ No newline at end of file
diff --git a/src/EllieBot/EllieBot.csproj b/src/EllieBot/EllieBot.csproj
index 0679d6d..223dcbb 100644
--- a/src/EllieBot/EllieBot.csproj
+++ b/src/EllieBot/EllieBot.csproj
@@ -109,7 +109,7 @@
     </ItemGroup>
 
     <ItemGroup>
-      <AdditionalFiles Include="data\strings\responses\responses.en-US.json" />
+      <AdditionalFiles Include="strings\responses\responses.en-US.json" />
     </ItemGroup>
 
     <ItemGroup>
@@ -133,6 +133,11 @@
         <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
         <CopyToOutputDirectory>Always</CopyToOutputDirectory>
       </None>
+      <None Update="strings\aliases.yml">
+        <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
+        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+      </None>
+
     </ItemGroup>
   
     <ItemGroup>
diff --git a/src/EllieBot/_common/CommandNameLoadHelper.cs b/src/EllieBot/_common/CommandNameLoadHelper.cs
index 0a811e2..7e30b50 100644
--- a/src/EllieBot/_common/CommandNameLoadHelper.cs
+++ b/src/EllieBot/_common/CommandNameLoadHelper.cs
@@ -10,14 +10,14 @@ public static class CommandNameLoadHelper
     private static readonly Lazy<Dictionary<string, string[]>> _lazyCommandAliases
         = new(() => LoadAliases());
 
-    public static Dictionary<string, string[]> LoadAliases(string aliasesFilePath = "data/aliases.yml")
+    public static Dictionary<string, string[]> LoadAliases(string aliasesFilePath = "strings/aliases.yml")
     {
         var text = File.ReadAllText(aliasesFilePath);
         return _deserializer.Deserialize<Dictionary<string, string[]>>(text);
     }
 
     public static Dictionary<string, CommandStrings> LoadCommandStrings(
-        string commandsFilePath = "data/strings/commands.yml")
+        string commandsFilePath = "strings/commands.yml")
     {
         var text = File.ReadAllText(commandsFilePath);
 
diff --git a/src/EllieBot/_common/Impl/Localization.cs b/src/EllieBot/_common/Impl/Localization.cs
index 9cfbf1b..dcde99d 100644
--- a/src/EllieBot/_common/Impl/Localization.cs
+++ b/src/EllieBot/_common/Impl/Localization.cs
@@ -11,7 +11,7 @@ public class Localization : ILocalization, IReadyExecutor
 {
     private static readonly Dictionary<string, CommandData> _commandData =
         JsonConvert.DeserializeObject<Dictionary<string, CommandData>>(
-            File.ReadAllText("./data/strings/commands/commands.en-US.json"));
+            File.ReadAllText("./strings/commands/commands.en-US.json"));
 
     private ConcurrentDictionary<ulong, CultureInfo> _guildCultureInfos;
 
diff --git a/src/EllieBot/_common/Services/strings/impl/LocalFileStringsSource.cs b/src/EllieBot/_common/Services/strings/impl/LocalFileStringsSource.cs
index 12b6ba9..84ae4e5 100644
--- a/src/EllieBot/_common/Services/strings/impl/LocalFileStringsSource.cs
+++ b/src/EllieBot/_common/Services/strings/impl/LocalFileStringsSource.cs
@@ -9,12 +9,12 @@ namespace EllieBot.Services;
 /// </summary>
 public class LocalFileStringsSource : IStringsSource
 {
-    private readonly string _responsesPath = "data/strings/responses";
-    private readonly string _commandsPath = "data/strings/commands";
+    private readonly string _responsesPath = "strings/responses";
+    private readonly string _commandsPath = "strings/commands";
 
     public LocalFileStringsSource(
-        string responsesPath = "data/strings/responses",
-        string commandsPath = "data/strings/commands")
+        string responsesPath = "strings/responses",
+        string commandsPath = "strings/commands")
     {
         _responsesPath = responsesPath;
         _commandsPath = commandsPath;
diff --git a/src/EllieBot/data/aliases.yml b/src/EllieBot/strings/aliases.yml
similarity index 100%
rename from src/EllieBot/data/aliases.yml
rename to src/EllieBot/strings/aliases.yml