Skip to content

Comments

Introduce Path object to siplify use of std::filesystem::path with QS…#817

Open
TheOneRing wants to merge 1 commit intomainfrom
work/path2
Open

Introduce Path object to siplify use of std::filesystem::path with QS…#817
TheOneRing wants to merge 1 commit intomainfrom
work/path2

Conversation

@TheOneRing
Copy link
Contributor

…tring

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new OCC::FileSystem::Path wrapper to ease interop between QString and std::filesystem::path, and refactors VFS setup code to derive the VFS root path from the SyncEngine rather than passing it around as a mutable QString.

Changes:

  • Add OCC::FileSystem::Path (src/libsync/path.{h,cpp}) and wire it into libsync build.
  • Refactor VfsSetupParams to remove the filesystemPath data member and add filesystemPath() / root() accessors; update CfApi call sites accordingly.
  • Adjust filesystem path conversion helpers (toFilesystemPath/fromFilesystemPath) and remove manual VFS path assignments in GUI/tests.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/testutils/syncenginetestutils.cpp Stops manually setting VFS root path in tests; relies on SyncEngine path via VfsSetupParams.
src/gui/folder.cpp Stops manually setting VFS root path in GUI; relies on SyncEngine path via VfsSetupParams.
src/libsync/vfs/vfs.h Removes filesystemPath member; introduces accessors and FileSystem::Path root storage.
src/libsync/vfs/vfs.cpp Initializes/stores VFS root as FileSystem::Path; uses it in dehydrated file cleanup.
src/plugins/vfs/cfapi/vfs_cfapi.cpp Updates usages to call filesystemPath() accessor.
src/plugins/vfs/cfapi/cfapiwrapper.cpp Updates usages to call filesystemPath() accessor (notably in async WinRT callback).
src/libsync/path.h / src/libsync/path.cpp Adds new FileSystem::Path wrapper type and basic join/conversion helpers.
src/libsync/common/filesystembase.h / src/libsync/common/filesystembase.cpp Changes toFilesystemPath signature and implementation; updates fromFilesystemPath conversion.
src/libsync/CMakeLists.txt Adds path.cpp to libsync build sources.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +8 to +31
OCC::FileSystem::Path::Path(QAnyStringView path)
: _path(toFilesystemPath(path.toString()))
{
}

OCC::FileSystem::Path::Path(const std::filesystem::path &path)
: _path(path)
{
}

OCC::FileSystem::Path::Path(std::filesystem::path &&path)
: _path(std::move(path))
{
}

OCC::FileSystem::Path OCC::FileSystem::Path::relative(QAnyStringView path)
{
return QtPrivate::toFilesystemPath(path.toString());
}

QString OCC::FileSystem::Path::toString() const
{
return fromFilesystemPath(_path);
}
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

FileSystem::Path is a new cross-platform path abstraction with Windows-specific behavior (long-path/\\?\ handling) and several operator overloads (relative, /, toString). There don’t appear to be tests covering its conversion/join behavior yet; adding a small unit test (including a Windows-only section) would help prevent regressions in path normalization and string round-tripping.

Copilot uses AI. Check for mistakes.
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.

1 participant