aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/savefile.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use SPDX license identifiersLucie GĂ©rard2022-08-261-24/+2
| | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Task-number: QTBUG-67283 Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Drop unused headers [I-Z]Jarek Kobus2022-05-251-3/+5
| | | | | | | | | Round 2 - focus on sources. For classes with initial in range [I-Z]. Try to keep the same separators between different kind of headers. Change-Id: I8a7ab99bab8120ee72cda6433ee3dc6f260a4d76 Reviewed-by: hjk <hjk@qt.io>
* Utils: More forward declarations / drop unused headers [S]Jarek Kobus2022-05-251-0/+2
| | | | | | | | | | | | Round 1 - focus on headers. For classes with initial in range [S]. Try to keep the same separators between different kind of headers. SmallString[xxx] classes skipped for now. Change-Id: Ie5c8edcb028e33eb8f9619e646afc462b91dca73 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
* Utils lib: Remove unneeded includes from cpp filesJarek Kobus2022-05-191-1/+1
| | | | | | | | It's a result of a team work consisting of yellow triangle and me. Change-Id: I8b4812766da70e0785ae71bf0cb71357379e2514 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* Utils: Move resolveSymLinks from FileUtils to FilePathhjk2021-07-021-2/+1
| | | | | | | And make it work with remote paths. Change-Id: I1fe4548547231338284152a86c43f5d0b1eba4d6 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Don't initialize QFlags unnecessarilyAlessandro Portale2020-01-211-1/+1
| | | | | | | And if needed, do it with {} instead of with nullptr or 0. Change-Id: Iae80253cd334494cfe1d69ec1552d710f2a31ad2 Reviewed-by: hjk <hjk@qt.io>
* Use even less nullptr for default flagshjk2020-01-201-10/+10
| | | | | Change-Id: I5ec30de3e41dfc1c7bf6d5f5e36991eadcbbfb72 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Some clang-tidy -use-modernize-nullptrhjk2019-08-011-9/+9
| | | | | Change-Id: I1bed5e85a5b7948d08502a72a10f80baa075c204 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* Utils: Rename FileName to FilePathhjk2019-05-281-1/+1
| | | | | | | | More in line with QFileInfo terminonlogy which appears to be best-of-breed within Qt. Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* SaveFile: Fix error handling when moving file with new contents failsEike Ziller2018-12-171-1/+2
| | | | | | | | | | | | | | The original content is moved to a backup, then the new file is moved into its place. If that second step fails, we have to at least try to move the backup back into the original place, and definitely not remove the backup. This behavior changed in 0dafe5cb8c8135d365c8cb0d365eae5ce66d268e Task-number: QTCREATORBUG-21724 Change-Id: I996098576c0ceed59dd7359ac4f1b9d33f87d596 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
* Merge remote-tracking branch 'origin/4.7' into 4.8Eike Ziller2018-09-271-7/+20
|\ | | | | | | Change-Id: Ia215af4ddad73053582284d3ce8d56b92dbbc8f3
| * Utils: Fix file saver for delete locked filesDavid Schulz2018-09-261-7/+20
| | | | | | | | | | | | | | | | | | If we can not delete a file via the ReplaceFile operation, because we ca not get the DELETE access right we still can try to replace it contents. Task-number: QTCREATORBUG-7668 Change-Id: I8804133a0e118518307f33976b821d5b2fdc9b8d Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* | Utils: Modernize furtherAlessandro Portale2018-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many issues, mostly in headers, were not addressed in e38410b76c40ffde33cf1ab405926cd243c4e48c modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using modernize-use-default-member-init modernize-use-equals-default Change-Id: I320a51726db881e582b898948d53735ebb06887a Reviewed-by: hjk <hjk@qt.io>
* | Utils: ModernizeAlessandro Portale2018-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using modernize-use-default-member-init modernize-use-equals-default Change-Id: I8d44d9405011a1878353baf9325f7af90b89db02 Reviewed-by: hjk <hjk@qt.io>
* | Revert "Windows: Match the name case of included files"Orgad Shaneh2018-07-191-1/+1
| | | | | | | | | | | | | | | | | | It breaks cross-compilation on linux/mingw. This reverts commit 1c014ed3d9256df0330338b34f1c710efa962cf8. Change-Id: I3e8183ec318541a4393ad242eefbdeaa78b7be44 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* | Windows: Match the name case of included filesAlessandro Portale2018-07-121-1/+1
|/ | | | | | | | | | | Although Windows is case insensitive, and lower case always works, Clang complains: Lexical or Preprocessor Issue: warning: non-portable path to file '<FooBar.h>'; specified path differs in case from file name on disk Change-Id: I8f94e9fb62f6afec8aa6b9d08a7c78f6ba8a4435 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* Fix issues with saving files on network drives on WindowsEike Ziller2018-06-291-1/+1
| | | | | | | | | | | In these cases the user might not have sufficient rights for ReplaceFile to merge all file attributes and ACLs. Make ReplaceFile ignore these errors. Task-number: QTCREATORBUG-20560 Change-Id: I6980d8af66cb7200c39726f0e7273df83c99bf5c Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* Utils: fix savefile in case we save new file (Windows)Ivan Donchevskii2017-12-201-12/+24
| | | | | | | | Previous fix accidently broke saving files that do not exist yet. They need to call rename instead of ReplaceFile. Change-Id: Ida47845a59c1f2fe26a39dc593ab0f83fae9d18b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Utils: Don't proceed with temp file which could not be openedRobert Loehning2017-12-191-1/+2
| | | | | Change-Id: I0e12d63ecaa52e9396216c4f59e12a9ba15d9774 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Utils: workaround for saving file opened by another applicationIvan Donchevskii2017-12-151-0/+19
| | | | | | | | | | | | | | | | | | | | | | | ...fixes file saving on Windows in specific circumstances. File deletion on Windows is quite tricky. If you simply remove the file opened by another app that shares it for deletion the file might become semi-removed. It looks like it still exists but it is in fact inaccessible for any operations until the other app frees the handle. To solve that case there is a ReplaceFile API call which carefully deals with that case. [Backstory] Oswald Buddenhagen insists that this fix is rather a workaround and we should solve file access problem in llvm. For that purpose we have QTCREATORBUG-19404 and upstream https://bugs.llvm.org/show_bug.cgi?id=35558 Task-number: QTCREATORBUG-15449 Change-Id: If37d484231b79d8e33822c795232dc31243c88c0 Reviewed-by: David Schulz <david.schulz@qt.io>
* Utils: take control over QTemporaryFile file lockIvan Donchevskii2017-12-151-12/+19
| | | | | | | | | | When we derive from QTemporaryFile we can't unlock file to be used by outer functions. With this change lock is managed by m_tempFile variable and can be released by reseting m_tempFile. Change-Id: I41339410471c69d1e73df49f04bc2d5c2036a064 Reviewed-by: David Schulz <david.schulz@qt.io>
* Utils: improve savefile error messagesIvan Donchevskii2017-12-151-10/+20
| | | | | Change-Id: I505c33e1e56a67a3682de2e2cbfe2ab967d04242 Reviewed-by: David Schulz <david.schulz@qt.io>
* Utils: remove unused variable in SaveFile classIvan Donchevskii2017-12-111-3/+2
| | | | | | | Backup member was never set to true. Change-Id: I21dc889813820e2a463c5ba812b18b57766e03c4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Utils: improve failed file saving behaviorIvan Donchevskii2017-07-031-2/+11
| | | | | | | | | Remove temporary files left after fail. Set error string for locked file. Task-number: QTCREATORBUG-15449 Change-Id: Ibc8b01a4ea47870c29493a69718db929070ac13f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Fix compiler warnings on windows.David Schulz2016-04-221-1/+2
| | | | | | | | | | | Ignore some warnings inside 3rd party code and fix a lot of conversion warnings. Change-Id: I909f2f31a4639015bf7dd028d2d435ff1d1167bc Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
* Update License according to agreement with Free Qt FoundationTobias Hunger2016-01-191-17/+12
| | | | | | | * Update remaining files in src Change-Id: I1896f17fcf34f71c3310c87899fb5171b8e4afb1 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* Update LicenseEike Ziller2015-01-161-6/+6
| | | | | Change-Id: I711d5fb475ef814a1dc9d2822740e827f3f67125 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* License updateEike Ziller2014-10-091-7/+8
| | | | | Change-Id: I3c22ef2685d7aa589f5d0ab74d693653a4c32082 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* Incremented year in copyright infoRobert Loehning2014-01-081-1/+1
| | | | | | Change-Id: Ib5423fdd064e4546f848c0b640b0ed0514c26d3a Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Utils: Make sure we only use fdatasync() on systems that have it.Christian Kandeler2013-02-061-3/+3
| | | | | Change-Id: I7260c05081942acd5ecd7c66e864d4efc5041add Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Merge remote-tracking branch 'origin/2.6'Oswald Buddenhagen2013-01-311-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/autotoolsprojectmanager/AutotoolsProjectManager.pluginspec.in src/plugins/debugger/qtmessageloghandler.cpp src/plugins/debugger/qtmessagelogwindow.cpp src/plugins/madde/maemodeployconfigurationwidget.cpp src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp src/plugins/qmldesigner/designercore/include/widgetqueryview.h src/plugins/qmldesigner/designercore/metainfo/metainfoparser.cpp src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp src/plugins/qnx/bardescriptormagicmatcher.h src/plugins/qt4projectmanager/profilekeywords.cpp src/plugins/remotelinux/deployablefilesperprofile.cpp src/plugins/remotelinux/deployablefilesperprofile.h src/plugins/remotelinux/deploymentinfo.cpp src/plugins/remotelinux/deploymentsettingsassistant.cpp src/plugins/remotelinux/profilesupdatedialog.cpp tests/auto/icheckbuild/ichecklib.cpp tests/auto/icheckbuild/parsemanager.cpp tests/auto/icheckbuild/parsemanager.h Change-Id: Ie465a578446a089e1c502d1cb1096e84ca058104
| * Incremented year in copyright infov2.6.2Robert Loehning2013-01-291-1/+1
| | | | | | | | | | Change-Id: Ic6a9ff0359625021ebc061d22db6811814534205 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* | Fix: Make sure umask is used when creating new filesKnut Petter Svendsen2013-01-291-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | When a new file was created from the file menu, the permissions on *nix was always 0600 regardless of the proess' current umask. Fixed by letting CorePlugin::initialize() initialize the umask in Utils::SaveFile. Since getting the system's umask is not thread safe this can't be done directly in SaveFile::open. Task-number: QTCREATORBUG-6513 Change-Id: I10d8b2f4ab85574ed3004b5e646664c2255196b9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* | Merge remote-tracking branch 'origin/2.6'Eike Ziller2012-10-051-21/+20
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: share/qtcreator/qml/qmlpuppet/commands/endpuppetcommand.cpp share/qtcreator/qml/qmlpuppet/commands/endpuppetcommand.h src/plugins/debugger/qtmessageloghandler.cpp src/plugins/debugger/qtmessageloghandler.h src/plugins/debugger/qtmessagelogwindow.cpp src/plugins/madde/maemodeployconfigurationwidget.cpp src/plugins/madde/maemodeployconfigurationwidget.h src/plugins/remotelinux/deployablefilesperprofile.cpp src/plugins/remotelinux/deployablefilesperprofile.h src/plugins/remotelinux/deploymentinfo.cpp src/plugins/remotelinux/deploymentinfo.h src/plugins/remotelinux/deploymentsettingsassistant.cpp src/plugins/remotelinux/profilesupdatedialog.cpp src/plugins/remotelinux/remotelinuxdeploymentdatamodel.h tests/auto/icheckbuild/ichecklib.cpp tests/auto/icheckbuild/ichecklib_global.h tests/auto/icheckbuild/parsemanager.cpp tests/auto/icheckbuild/parsemanager.h tests/manual/ssh/tunnel/tunnel.h Change-Id: I04d7761df6bd936ad00e0547974284c967d39580
| * Adjust license headershjk2012-10-051-21/+20
| | | | | | | | | | Change-Id: Ice592c6de9951ee3b2c4cb52ed0bb3b6770e0825 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
* | Utils::FileUtils: Use Utils::FileName for file paths instead of QString.Christian Kandeler2012-09-071-1/+2
|/ | | | | | | Change-Id: I9ee4c0760820e9299e238c116936ce8ef140c727 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com> Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
* Build fix for Mac OSEike Ziller2012-08-201-0/+2
| | | | | Change-Id: Iec4e4fdddf6b5eadbdcaae2500df841f0cf57dd4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Fix compilation of MinGW-w64 4.7Yuchen Deng2012-08-171-1/+1
| | | | | Change-Id: Ieab538a077351549727c94dad17d4d77ab492a97 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* properly sync file's data on commitOswald Buddenhagen2012-08-161-0/+14
| | | | | | | this ensures that creator doesn't eat my config files on every crash. Change-Id: I18f8135158e17d064774a49fe170b63c89517e49 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* Contact -> qt-project.orgEike Ziller2012-07-191-3/+1
| | | | | Change-Id: I7134d7de30bcf9f9dcfad42520dd45ee083a852d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Long live the king!hjk2012-01-261-1/+1
| | | | | Change-Id: I2b72b34c0cfeafc8bdbaf49b83ff723544f2b6e2 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
* Don't try finalizing files that were never created.Eike Ziller2011-12-051-1/+2
| | | | | | | Task-number: QTCREATORBUG-6643 Change-Id: I04945ebb39caace476a12f293666cfcec0f8a9e5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* all: s/info@qt.nokia.com/qt-info@nokia.com/hjk2011-11-031-2/+2
| | | | | Change-Id: If18afb5d4665924e7d9250dccbc60a65e6daa75e Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
* don't rewrite symlink on save, rewrite target insteadVlad Brovko2011-10-201-4/+6
| | | | | | | Merge-request: 399 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Change-Id: If81446a8fd49e9de7611c2f09abd39af2c9c930d
* Utils/Coreplugin: Clean headers.Friedemann Kleint2011-08-171-8/+2
| | | | | | | Change-Id: I1e0d432127651622d40ff990e1866eac9fac46a0 Reviewed-on: http://codereview.qt.nokia.com/3091 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Fix/add copyright headersTobias Hunger2011-05-061-1/+1
| | | | Change-Id: I8b73d583be1ee7183f4074bce49d5390e38631a2
* add Utils::SaveFile: class for atomic saving of filesOswald Buddenhagen2011-04-181-0/+106
inspired by KSaveFile