Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

Command line arguments with relative paths (e.g., quicklook 1.txt) failed when invoked from directories other than the QuickLook installation directory. File.Exists() and Directory.Exists() were checking paths against the application's working directory instead of the shell's current directory.

Changes

  • Convert relative paths to absolute using Path.GetFullPath() before existence checks in both first and second instance code paths
  • Add specific exception handling for ArgumentException, SecurityException, NotSupportedException, and PathTooLongException
// Before
if (e.Args.Any() && (Directory.Exists(e.Args.First()) || File.Exists(e.Args.First())))
    PipeServerManager.SendMessage(PipeMessages.Toggle, e.Args.First());

// After
if (e.Args.Any())
{
    try
    {
        var path = Path.GetFullPath(e.Args.First());
        if (Directory.Exists(path) || File.Exists(path))
            PipeServerManager.SendMessage(PipeMessages.Toggle, path);
    }
    catch (Exception ex) when (ex is ArgumentException || ex is SecurityException || 
                               ex is NotSupportedException || ex is PathTooLongException)
    {
        // Invalid path, ignore
    }
}

Absolute paths continue to work unchanged. Invalid paths are silently ignored.

Original prompt

This section details on the original issue you should resolve

<issue_title>Command line only works with absolute path</issue_title>
<issue_description>Describe the bug

2026-01-13.214436.mp4

As the video shows:

  • Using relative path quicklook 1.txt does nothing.
  • Using absolute path quicklook D:/test/1.txt shows preview.
  • When I change current dir to QuickLook program folder, these two ways both work.

To Reproduce
Follow my video.

Expected behavior
Relative path also works.

Desktop (please complete the following information):

  • OS Version: Windows 11 PRO 25H2 26200.7462
  • QuickLook Version: 4.4.0 from EXE installer
    </issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 13, 2026 16:43
Co-authored-by: emako <24737061+emako@users.noreply.github.com>
Co-authored-by: emako <24737061+emako@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix command line to accept relative paths Fix command line relative path resolution Jan 13, 2026
Copilot AI requested a review from emako January 13, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Command line only works with absolute path

2 participants