VcsBasePlugin: Use FilePath::relativePath

Instead of QDir::relativeFilePath().

Change-Id: Iacd25e51dc87b987402ff3677f6705c6e0e8edbf
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-10-04 13:27:02 +02:00
parent c666c93882
commit 993fd2a92a

View File

@@ -372,8 +372,7 @@ FilePath VcsBasePluginState::currentFileDirectory() const
QString VcsBasePluginState::relativeCurrentFile() const
{
QTC_ASSERT(hasFile(), return {});
return QDir(data->m_state.currentFileTopLevel.toString()).relativeFilePath(
data->m_state.currentFile.toString());
return data->m_state.currentFile.relativePath(data->m_state.currentFileTopLevel).toString();
}
QString VcsBasePluginState::currentPatchFile() const
@@ -406,8 +405,7 @@ QString VcsBasePluginState::relativeCurrentProject() const
QTC_ASSERT(hasProject(), return QString());
if (data->m_state.currentProjectTopLevel == data->m_state.currentProjectPath)
return {};
return QDir(data->m_state.currentProjectTopLevel.toString()).relativeFilePath(
data->m_state.currentProjectPath.toString());
return data->m_state.currentProjectPath.relativePath(data->m_state.currentProjectTopLevel).toString();
}
bool VcsBasePluginState::hasTopLevel() const