forked from qt-creator/qt-creator
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:
@@ -618,12 +618,14 @@ void BinEditorDocument::setModified(bool modified)
|
|||||||
bool BinEditorDocument::save(QString *errorString, const FilePath &oldFilePath, const FilePath &newFilePath)
|
bool BinEditorDocument::save(QString *errorString, const FilePath &oldFilePath, const FilePath &newFilePath)
|
||||||
{
|
{
|
||||||
if (oldFilePath != newFilePath) {
|
if (oldFilePath != newFilePath) {
|
||||||
|
// Get a unique temporary file name
|
||||||
FilePath tmpName;
|
FilePath tmpName;
|
||||||
{
|
{
|
||||||
QTemporaryFile tmp(newFilePath.toString() + QLatin1String("_XXXXXX.new"));
|
const auto result = TemporaryFilePath::create(
|
||||||
if (!tmp.open())
|
newFilePath.stringAppended("_XXXXXX.new"));
|
||||||
|
if (!result)
|
||||||
return false;
|
return false;
|
||||||
tmpName = FilePath::fromString(tmp.fileName());
|
tmpName = (*result)->filePath();
|
||||||
}
|
}
|
||||||
if (!oldFilePath.copyFile(tmpName))
|
if (!oldFilePath.copyFile(tmpName))
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user