Skip to content

frontend: Fix profile import with trailing path slash - #13863

Merged
RytoEX merged 1 commit into
obsproject:masterfrom
Ushkalovk:fix/profile-import-trailing-slash
Oct 8, 2026
Merged

RytoEX merged 1 commit into
obsproject:masterfrom
Ushkalovk:fix/profile-import-trailing-slash

Conversation

@Ushkalovk

@Ushkalovk Ushkalovk commented Sep 3, 2026 •

Copy link
Copy Markdown

Description

Normalizes the directory selected in the profile import dialog with QDir::cleanPath() before deriving the profile directory name from it.

Motivation and Context

When the directory chooser returns a path with a trailing separator, std::filesystem::path::filename() yields an empty string. The import then uses an empty directory name, copies the profile files into the profiles root and no new profile shows up in the list.

Fixes #13862

How Has This Been Tested?

macOS 26, Xcode build. Imported a profile from a directory path with and without a trailing slash; both now create a correctly named profile that appears in the profile menu. Importing a profile whose directory name already exists still shows the "profile exists" warning.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed.
  • I have included updates to all appropriate documentation.

The directory chooser can return a path that ends with a separator,
e.g. when the path is typed manually or on some platform dialogs.
std::filesystem::path::filename() returns an empty string for such a
path, so the imported profile gets an empty directory name and its
files are copied directly into the profiles root instead of a new
profile directory. No new profile appears in the profile list.

Normalize the selected path with QDir::cleanPath() before building the
filesystem path, which strips the trailing separator and yields the
actual directory name.
@WizardCM WizardCM added the kind/bug Categorizes issue or PR as related to a bug. label Sep 13, 2026

@PatTheMav PatTheMav left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems uncontroversial to me. I wonder how the picker can end up providing such a path, but if Qt provides a built-in facility to clean this up, it doesn't seem problematic to use it.

@Ushkalovk

Copy link
Copy Markdown
Author

@PatTheMav Hey, maybe you know someone from the Maintainers team who could approve this fix?

@RytoEX
RytoEX merged commit 5b07ed1 into obsproject:master Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug.

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

Profile import fails on macOS in 32.2.2: profile name parsed as empty, files copied to profiles root ("File exists" error)

5 participants