Skip to content

File > Set Dev Directory throws on the render thread for a relative, ~ or quoted path #478

Description

@matt-edmondson

What's wrong

The "Set Dev Directory" popup callback (ProjectDirector/ProjectDirector.cs:876-885) passes whatever the user typed straight to AbsoluteDirectoryPath.Create<AbsoluteDirectoryPath>(result). The only guard is string.IsNullOrEmpty.

With ktsu.Semantics.Paths 5.11.0 (the pinned version), these inputs all throw ArgumentException: Cannot convert "..." to AbsoluteDirectoryPath:

  • dev (relative)
  • ~/dev
  • " /tmp/x" (leading space)
  • "\"C:\\dev\"" (quoted)

The callback runs from PopupSetDevDirectory.ShowIfOpen() inside Tick (ProjectDirector.cs:684), which is the render thread. Nothing there catches the exception, so it escapes the render loop and takes the app down. #440 and #444 treat a throw on the render thread the same way.

Failure scenario

On Windows, a user copies their dev folder with Explorer's "Copy as path", which wraps it in quotes ("C:\dev"). They paste it into the popup and press OK, and the app crashes. Typing ~/dev or a relative folder name does the same.

Suggested fix

  • Trim whitespace and a surrounding pair of quotes from the input.
  • Optionally expand a leading ~ to the user profile directory.
  • Validate with Path.IsPathFullyQualified, or catch ArgumentException. On rejection, QueueLog the reason and keep the previous DevDirectory.

Acceptance criteria

  • Entering dev, "C:\dev", ~/dev or " C:\dev " never throws.
  • Each input either sets a valid absolute DevDirectory (for the quoted and padded cases) or leaves it unchanged and logs why the input was refused.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions