BinEditor: Replace FilePath::toString

Replace occurrences of FilePath::toString with more sensible alternatives.

Change-Id: Ic6a313f6dbd75c39f7c3054526f232c07c2023d5
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Andrii Semkiv
2024-09-06 16:01:21 +02:00
parent 05c77431cf
commit 828440b0ff

View File

@@ -618,12 +618,14 @@ void BinEditorDocument::setModified(bool modified)
bool BinEditorDocument::save(QString *errorString, const FilePath &oldFilePath, const FilePath &newFilePath)
{
if (oldFilePath != newFilePath) {
// Get a unique temporary file name
FilePath tmpName;
{
QTemporaryFile tmp(newFilePath.toString() + QLatin1String("_XXXXXX.new"));
if (!tmp.open())
const auto result = TemporaryFilePath::create(
newFilePath.stringAppended("_XXXXXX.new"));
if (!result)
return false;
tmpName = FilePath::fromString(tmp.fileName());
tmpName = (*result)->filePath();
}
if (!oldFilePath.copyFile(tmpName))
return false;