Skip to content

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

Open
Ushkalovk wants to merge 1 commit into
obsproject:masterfrom
Ushkalovk:fix/profile-import-trailing-slash
Open

frontend: Fix profile import with trailing path slash#13863
Ushkalovk wants to merge 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.
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.

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

2 participants