about summary refs log tree commit diff
path: root/MatrixRoomUtils.Desktop/MRUDesktopConfiguration.cs
diff options
context:
space:
mode:
authorEmma@Rory& <root@rory.gay>2023-08-14 19:46:33 +0200
committerEmma@Rory& <root@rory.gay>2023-08-14 19:46:33 +0200
commit83029c478f411bcadd3be53ac4dc53d88b3c8462 (patch)
tree279d62e53e55e862e4851f1447de12e47e3fce62 /MatrixRoomUtils.Desktop/MRUDesktopConfiguration.cs
parentAdd MxApiExtensions submodule (diff)
downloadMatrixUtils-83029c478f411bcadd3be53ac4dc53d88b3c8462.tar.xz
Code cleanup
Diffstat (limited to 'MatrixRoomUtils.Desktop/MRUDesktopConfiguration.cs')
-rw-r--r--MatrixRoomUtils.Desktop/MRUDesktopConfiguration.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/MatrixRoomUtils.Desktop/MRUDesktopConfiguration.cs b/MatrixRoomUtils.Desktop/MRUDesktopConfiguration.cs
index 39c42cf..4f265ee 100644
--- a/MatrixRoomUtils.Desktop/MRUDesktopConfiguration.cs
+++ b/MatrixRoomUtils.Desktop/MRUDesktopConfiguration.cs
@@ -11,7 +11,7 @@ public class MRUDesktopConfiguration {
 
     public MRUDesktopConfiguration(ILogger<MRUDesktopConfiguration> logger, IConfiguration config, HostBuilderContext host) {
         _logger = logger;
-        logger.LogInformation($"Loading configuration for environment: {host.HostingEnvironment.EnvironmentName}...");
+        logger.LogInformation("Loading configuration for environment: {}...", host.HostingEnvironment.EnvironmentName);
         config.GetSection("MRUDesktop").Bind(this);
         DataStoragePath = ExpandPath(DataStoragePath);
         CacheStoragePath = ExpandPath(CacheStoragePath);
@@ -22,18 +22,18 @@ public class MRUDesktopConfiguration {
     public string? SentryDsn { get; set; }
 
     private static string ExpandPath(string path, bool retry = true) {
-        _logger.LogInformation($"Expanding path `{path}`");
+        _logger.LogInformation("Expanding path `{}`", path);
 
         if (path.StartsWith("~")) {
             path = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), path[1..]);
         }
 
-        Environment.GetEnvironmentVariables().Cast<DictionaryEntry>().OrderByDescending(x => x.Key.ToString().Length).ToList().ForEach(x => {
+        Environment.GetEnvironmentVariables().Cast<DictionaryEntry>().OrderByDescending(x => x.Key.ToString()!.Length).ToList().ForEach(x => {
             path = path.Replace($"${x.Key}", x.Value.ToString());
         });
 
-        _logger.LogInformation($"Expanded path to `{path}`");
-        int tries = 0;
+        _logger.LogInformation("Expanded path to `{}`", path);
+        var tries = 0;
         while(retry && path.ContainsAnyOf("~$".Split())) {
             if(tries++ > 100)
                 throw new Exception($"Path `{path}` contains unrecognised environment variables");