Skip to content

Commit

Permalink
Use string interpolation.
Browse files Browse the repository at this point in the history
  • Loading branch information
peters committed Jun 26, 2020
1 parent ff52820 commit c571263
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Snap/AnyOS/Windows/SnapOS.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ string GetLinkTarget(SnapShortcutLocation location, string title, string applica
return Filesystem.PathCombine(targetDirectory, title + ".lnk");
}

logger?.Info("About to create shortcuts for {0}, base directory {1}", exeName, baseDirectory);
logger?.Info($"About to create shortcuts for {exeName}, base directory {baseDirectory}");

var fileVerInfo = FileVersionInfo.GetVersionInfo(shortcutDescription.ExeAbsolutePath);

Expand All @@ -196,11 +196,11 @@ string GetLinkTarget(SnapShortcutLocation location, string title, string applica
// annoy them by recreating it.
if (!fileExists && shortcutDescription.UpdateOnly)
{
logger?.Warn("Wanted to update shortcut {0} but it appears user deleted it", file);
logger?.Warn($"Wanted to update shortcut {file} but it appears user deleted it");
continue;
}

logger?.Info("Creating shortcut for {0} => {1}", exeName, file);
logger?.Info($"Creating shortcut for {exeName} => {file}");

ShellLink shellLink;
logger?.ErrorIfThrows(() => SnapUtility.Retry(() =>
Expand Down Expand Up @@ -250,7 +250,7 @@ void FixPinnedExecutables(string baseDirectory, SemanticVersion newCurrentVersio
{
if (Environment.OSVersion.Version < new Version(6, 1))
{
logger?.Warn("fixPinnedExecutables: Found OS Version '{0}', exiting", Environment.OSVersion.VersionString);
logger?.Warn($"fixPinnedExecutables: Found OS Version '{Environment.OSVersion.VersionString}', exiting");
return;
}

Expand Down Expand Up @@ -315,25 +315,25 @@ void UpdateShellLink([JetBrains.Annotations.NotNull] string baseDirectory, [JetB
if (shortcut == null) throw new ArgumentNullException(nameof(shortcut));
if (newAppPath == null) throw new ArgumentNullException(nameof(newAppPath));

logger?.Info("Processing shortcut '{0}'", shortcut.ShortCutFile);
logger?.Info($"Processing shortcut '{shortcut.ShortCutFile}'");

var target = Environment.ExpandEnvironmentVariables(shortcut.Target);
var targetIsUpdateDotExe = target.EndsWith("update.exe", StringComparison.OrdinalIgnoreCase);

logger?.Info("Old shortcut target: '{0}'", target);
logger?.Info($"Old shortcut target: '{target}'");

target = Filesystem.PathCombine(baseDirectory, Filesystem.PathGetFileName(targetIsUpdateDotExe ? shortcut.Target : shortcut.IconPath));

logger?.Info("New shortcut target: '{0}'", target);
logger?.Info($"New shortcut target: '{target}'");

shortcut.WorkingDirectory = newAppPath;
shortcut.Target = target;

logger?.Info("Old iconPath is: '{0}'", shortcut.IconPath);
logger?.Info($"Old iconPath is: '{shortcut.IconPath}'");
shortcut.IconPath = target;
shortcut.IconIndex = 0;

logger?.ErrorIfThrows(() => SnapUtility.Retry(shortcut.Save), "Couldn't write shortcut " + shortcut.ShortCutFile);
logger?.ErrorIfThrows(() => SnapUtility.Retry(shortcut.Save), $"Couldn't write shortcut {shortcut.ShortCutFile}");
logger?.Info("Finished shortcut successfully");
}

Expand Down

0 comments on commit c571263

Please sign in to comment.