summaryrefslogtreecommitdiff
path: root/src/libs/utils/fileutils.h
Commit message (Collapse)AuthorAgeFilesLines
* CMakeProjectManager: Fix clang code model when CMake PCHs are usedCristian Adam2019-10-221-0/+1
| | | | | | | | | CMake gives the path to the cmake_pch.h[xx] file as relative path to build directory. Making it absolute fixes the code model. Fixes: QTCREATORBUG-22888 Change-Id: I2fdc080be779f22b737788be2074254290994aaa Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Utils: Add a FilePath::isDir() convenience functionhjk2019-09-111-1/+2
| | | | | Change-Id: I1df0ee1b136299ae6e4f2e5bd0bdc24bfeca33dd Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Split FilePath::fileNamehjk2019-08-141-1/+2
| | | | | | | | | | | Into the regular case, and a fileNameWithPathComponents() function handling the rarely used case with argument. This saves a few cycles in the regular case and makes the function usable by member function pointer in e.g. Utils::transform. Change-Id: Ic4469198c3f8a44f59e50d70e67b864d876700d5 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* check if Android sdk folder is writableFrederik Schwarzer2019-08-131-0/+1
| | | | | | Fixes: QTCREATORBUG-21943 Change-Id: Ic20ed4c24c567b0b08269b7ad07014eb4248b214 Reviewed-by: hjk <hjk@qt.io>
* Utils: Register CommandLinehjk2019-07-311-1/+2
| | | | | | | Needed e.g. in VCS support. Change-Id: I3a9d64526bc0bf60a77ab154408dfec94cc6ba75 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Drop transitional FileName alias for FilePathhjk2019-07-241-4/+1
| | | | | | | Transition is over... Change-Id: Iacaccead238130c8fdb347e172189ecc82b33401 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Move meta char policy handling from FilePath to ConsoleProcesshjk2019-07-231-6/+1
| | | | | | | Currently the only place that's using it and the scope is much smaller. Change-Id: I1a43d14f0e2c69a16f76e6f83b82436bbeeac1c9 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Utils: Add CommandLine convenience constructorshjk2019-07-231-0/+2
| | | | | | | | | | | | | ... taking a QString for the executable. This weakens the very explicit QString -> FileName conversion via the named constructors for the special case of constructing a CommandLine. I think that's worthwhile here, as it reduces the noise on the caller site under circumstance where the nature of the thing is obvious. Change-Id: I27b4a73639728893d053b2e7ba65cb745f0ffe83 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Merge remote-tracking branch 'origin/4.10'Eike Ziller2019-06-201-1/+1
|\ | | | | | | | | | | | | Conflicts: src/libs/utils/consoleprocess.h Change-Id: I771630cb4dc60a9e87e9d30d6295040c27348d8c
* \ Merge remote-tracking branch 'origin/4.10'Eike Ziller2019-06-181-1/+6
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | Conflicts: src/libs/utils/consoleprocess.h src/libs/utils/consoleprocess_unix.cpp src/libs/utils/consoleprocess_win.cpp src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp src/tools/clangrefactoringbackend/source/symbolscollector.cpp tests/unit/mockup/projectexplorer/project.h Change-Id: I8d10f26b9bcb54829ba31cdc2272885691df1e16
* | Utils: Encourage marking of raw command line parametershjk2019-06-061-5/+7
| | | | | | | | | | Change-Id: Id66ac07732c66ab8c1232fe1f58042de8a61abb0 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | Utils: Add a CommandLine::splitArguments() convenience functionhjk2019-06-061-0/+1
|/ | | | | | | | ... and use it from within new SynchronousProcess functions taking CommandLine arguments. Change-Id: I5d7f83727cbb22f03b1a79b1645db95514c66033 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Utils: Pass an optional OsType parameter to CommandLine::addArghjk2019-06-051-2/+2
| | | | | | | ... and extend the idea to addArgs(list) Change-Id: Ia5423ee5ab96835b4adc23b72749e9c13892ee83 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Utils: Move CommandLine to fileutils.{cpp,h}hjk2019-06-031-0/+23
| | | | | | | | Causes less #include hassle when using downstream instead of command/argument pairs. Change-Id: I0fa0d016374df0b8e0a22f3786623652af684d36 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Utils: Remove rarely used FilePath constructorhjk2019-05-281-1/+0
| | | | | | | Not much benefit interface-wise. Change-Id: I0e605ec235e8072efcbf7e777cf7e8f8ee5e0799 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Rename FileName to FilePathhjk2019-05-281-38/+41
| | | | | | | | 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>
* Utils: Remove now-unused FileName::appendPath()hjk2019-05-271-1/+0
| | | | | Change-Id: I9d429a1f60930e27e3926e1242114bed3485f000 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Make FileName::shortNativePath a memberhjk2019-05-201-1/+2
| | | | | Change-Id: If1ab02ae9dc7efb97792cdf3bbdce3bba18b3e3d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Make FileName::isFileNewerThan a memberhjk2019-05-201-1/+2
| | | | | | | Easier to discover and more compact in use. Change-Id: I93dae0570a1dfded4d40dd6ae69b99fe82e3788f Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Make FileName::canonicalPath a memberhjk2019-05-201-1/+2
| | | | | Change-Id: I8d7450dec5c4c14ae3e007d1d66f1a9c3c98f807 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Make FileName hold an QUrl optionallyhjk2019-05-171-0/+11
| | | | | | | | | | | | | | | | | This is meant to be helpful to piggy-back device information in situations where the file resides on a remote file system. The approach taken effectively duplicates the path data of the url if the url constructor is actually used, but does not rely on lossless path/fromPath conversions as it leaves the non-url code paths unaffected in all situations. The total overhead is deemed acceptable as the common use case only default-constructs the m_url member which only sets a pimpl nullptr. Change-Id: Ie441cb1355ce086507333c31c7356ae5e6d10b96 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Introduce a non-mutating FileName::pathAppendedhjk2019-05-151-0/+1
| | | | | | | ... and start using it. The plan is to replace all appendPath() uses. Change-Id: I555bcfa742b99b0951b98b0c0e707422c348fadb Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Replace mutating FileName::appendStringhjk2019-05-151-2/+1
| | | | | | | ... by a non-mutating .stringAppended, doing the same. Change-Id: I7adb6cae3415942cc9a80088bd75cda9d577d4a5 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Use data member instead of inheritance in FileNamehjk2019-05-131-8/+8
| | | | | Change-Id: Ib0a9889dfa34ea877ee413881e87ab12c3a54956 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Replace FileName::FileName(QFileInfo) by a named constructorhjk2019-05-131-2/+4
| | | | | | | | | More consistent with the fromString case and avoiding false conversions QString -> QFileInfo -> FileName in case the inheritance of QString suddenly disappears. Change-Id: Ib14646ab1a660fd45dd1ea6862a0b5faa52ad0e3 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Remove FileName::isNullhjk2019-05-131-1/+0
| | | | | | | ... and its uses in order to shrink the FileName interface. Change-Id: I4b9a229d98ad53c4f189e381c89241981ddbed2e Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: RemoveFileName::{size,count,length}hjk2019-05-101-3/+1
| | | | | | | Use .toString().{size,count,length} instead. Change-Id: Ib697155f441a8297fb179921bcd3397719a44073 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Remove unused FileName::chophjk2019-05-101-1/+0
| | | | | | | It's unused, and non-const, so not nice-to-have in the url-using case. Change-Id: I5ec7d06e74b20b22a2fd8467222a135a6dcce814 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Detect hardlinks also on WindowsOrgad Shaneh2019-04-301-0/+1
| | | | | | | | | | | | | Believe it or not, they exist :) Git for Windows installs all its exectables as hardlinks for instance. Logic copied from qfilesystemengine_{win,unix}.cpp in Qt. This amends commit 118f713eb45387ead9a7bb076451ec33e7d5ca03. Change-Id: Iafc64be4b2150378c7f9676fda0e01a43cd8b7cf Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Utils: Rename one of the FileName::fromString overloadshjk2019-03-191-1/+1
| | | | | | | Overloaded functions are ugly to use in algorithms like transform(). Change-Id: Ia4f191e1cd9a21ceb99dec23a8f4fd1ce5f24182 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CompilationDatabase: Add folders to Project viewIvan Donchevskii2018-11-051-0/+1
| | | | | Change-Id: I4cd480535c203aa923b27596ea4ca74f83c12a9e Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Utils: Modernize furtherAlessandro Portale2018-07-241-2/+2
| | | | | | | | | | | | | | | 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: Properly name withNtfsPermissions()Andre Hartmann2018-06-051-4/+4
| | | | | Change-Id: I759e702b63f8bed9384ccbfae6345f858e50830b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Consistently use nullptrTobias Hunger2018-05-131-3/+4
| | | | | | | Fixed by clang-tidy modernize-use-nullptr. Change-Id: I93edae67271a521e3b2a1f97f486e5fa97009836 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Utils: Use override consistentlyTobias Hunger2018-05-131-3/+4
| | | | | | | clang-tidy fixes from modernize-use-override check. Change-Id: I89d27f359b6ee507153cb3712f61f81471ff0858 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* File System view: Add "New Folder" to context menuEike Ziller2018-04-111-0/+1
| | | | | | Task-number: QTCREATORBUG-17358 Change-Id: I64b3d34ca0432369630382c40cf749f3cc1a08df Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Fix Utils::withNTFSPermissions with void functionEike Ziller2018-02-201-2/+5
| | | | | | | | | | Fix up of 9467ed42c3661c13494731e0f13ce0ba5f1dc7be Change-Id: I24343e5e1440210188742332ec6f725af3412100 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Add a bread crumb widget to file system viewEike Ziller2017-11-141-3/+4
| | | | | | | | Which allows easy navigation to any parent of the current selection. Task-number: QTCREATORBUG-19203 Change-Id: I97179a4800afd92a21bd0fa466fbfda4ac1a5846 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* HostOsInfo/FileUtils/PersistentSettings: Fix build without QtGuiEike Ziller2017-08-221-0/+4
| | | | | | | | | Interesting for command line tools that want to pull this in but not QtGui (e.g. sdktool) Change-Id: Ic2f5c1f3126869cc38bf672345750d7d966560fd Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* FileUtils: Remove unused includes and forward declarationEike Ziller2017-08-221-1/+0
| | | | | | | Left over after moving functionality to dragsupport.cpp/.h Change-Id: I909be9eb42fb96989e9469278b416e25f3ac7f62 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Fix buildIvan Donchevskii2017-07-031-1/+1
| | | | | | | | Move constructor definition to .cpp file to avoid it being inlined Change-Id: I1c55095e5158740526af9e698c978abf33304e52 Reviewed-by: hjk <hjk@qt.io>
* Utils: use unique_ptr for QFile objectIvan Donchevskii2017-07-031-5/+5
| | | | | | | Do not use raw pointer. Change-Id: I6810c3ec3a60a43829130cf5e5a00e52db95b965 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add std::hash for FileNameEike Ziller2017-06-191-0/+16
| | | | | Change-Id: Iaef49c826c0febf3a9cb1fdc97de9f92c261cf40 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Fix check if example location is writable on WindowsEike Ziller2017-05-291-0/+27
| | | | | | | | | The normal permission check done by QFileInfo is not sufficient in many cases. Task-number: QTCREATORBUG-18184 Change-Id: Icab92c592e6d3c8610304e0b987eded6142f4ab3 Reviewed-by: David Schulz <david.schulz@qt.io>
* Merge remote-tracking branch 'origin/4.0' into 4.1Eike Ziller2016-06-221-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qtcreator.pri qtcreator.qbs src/plugins/android/android.qbs src/plugins/android/androiddevice.cpp src/plugins/autotest/testcodeparser.cpp src/plugins/debugger/analyzer/analyzerstartparameters.h src/plugins/projectexplorer/devicesupport/desktopdevice.cpp src/plugins/projectexplorer/devicesupport/idevice.cpp src/plugins/projectexplorer/runconfiguration.h Change-Id: I2474d06f2309fa71210a8401846bc2ef85bebf1d
| * cmake: resolve symlinks when comparing source directories.David Faure2016-06-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | Testcase: trying to use an existing build dir which was made for /d/foo where /d is a symlink to $HOME/d. To help understanding the problem, the error message now prints both source dirs, the one found in the builddir and the one we expected. Change-Id: I9a24fbd6ef3cf8108c5edba0d2a5b99ecdea0e89 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* | Wholesale conversion to #pragma oncehjk2016-03-301-4/+1
|/ | | | | | | Kudos to cgmb and https://github.com/cgmb/guardonce Change-Id: Ifa8970734b8d43fd08c9260c645bdb0228633791 Reviewed-by: Tobias Hunger <tobias.hunger@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>
* FileUtils: Replace FileNameList with an aliasTobias Hunger2015-11-041-10/+1
| | | | | | | | | | | The functionality in that class is covered by initializers and Utils::unique, so there is no need to keep a custom class. This way FileNameList plays way nicer with utils/algorithm.h. Change-Id: I8eeae6aca0558ecd998920c4fdfc5ea56bf75501 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
* Introduce dragging for all explorer nodes.Jochen Becher2015-06-151-53/+0
| | | | | | | | | | | | | Extend drop support with variant values. A drop may be a file drop or a value drop or both. Rename Utils::FileDropSupport to Utils::DropSupport and add methods to add not only files but any QVariant value to the mime data. Project explorer adds dragged nodes (which will be needed for future ModelEditor plugin). Change-Id: I799542c60fdecb3e64af0d3ba47b6caa9adbcfd7 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>