Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/LogExpert.Core/Classes/Persister/PersisterHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.ObjectModel;

using LogExpert.Core.Helpers;
using LogExpert.Core.Interfaces;

namespace LogExpert.Core.Classes.Persister;
Expand All @@ -10,8 +11,9 @@ public static class PersisterHelpers
private const string LOCAL_FILE_SYSTEM_NAME = "LocalFileSystem";

/// <summary>
/// Checks if the file name is a settings file (.lxp). If so, the contained logfile name
/// is returned. If not, the given file name is returned unchanged.
/// Resolves a shortcut to the file it points at, then checks if that file is a settings file
/// (.lxp). If so, the contained logfile name is returned. If not, the given file name is
/// returned unchanged.
/// </summary>
/// <param name="fileName">The file name to resolve</param>
/// <param name="pluginRegistry">Plugin registry for file system resolution (optional)</param>
Expand All @@ -20,6 +22,11 @@ public static string FindFilenameForSettings (string fileName, IPluginRegistry p
{
ArgumentException.ThrowIfNullOrWhiteSpace(fileName, nameof(fileName));

// A shortcut is not a log file: resolve it first, so the rest of this method — the .lxp
// lookup included — sees the file the user actually meant. Anything unresolvable comes back
// unchanged and keeps the previous behaviour.
fileName = ShellLinkResolver.Resolve(fileName);

if (fileName.EndsWith(".lxp", StringComparison.OrdinalIgnoreCase))
{
var persistenceData = Persister.Load(fileName);
Expand Down
Loading
Loading