summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemengine_unix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use Finder bundle identifier over path for OS X bundle detectionSamuel Gaist2014-04-031-3/+4
| | | | | | | | | | | | | | | | Currently, checking if Finder is the application returned for opening a bundle is done using its absolute path. Finder might be relocated in future OS X versions which makes this approach less clean. Using Finder's bundle identifier allows us to ignore where it is stored in the filesystem as the identifier will not change. Task-number: QTBUG-31884 Change-Id: Ib4c3412fb206fadda04eb547bc6a4eef02ee949a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jake Petroules <jake.petroules@petroules.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use Uniform Type Identifiers to detect OS X bundlesSamuel Gaist2014-03-141-30/+18
| | | | | | | | | | | | | | | | | Following Apple's documentation, the first step to identify a bundle is to check if it has a known extension. Currently, it's done using string comparisons ored in an if statement. The list is not complete and new types, whether provided by a system update or other means, can't be detected. The new approach is to use Uniform Type Identifier which queries the OS directly to check whether the extension conforms to kUTTypeBundle. That includes e.g. applications, frameworks etc. Task-number: QTBUG-31884 Change-Id: Ief73a83904adf27ccb71b0070e67cba081d1fd4a Reviewed-by: Jake Petroules <jake.petroules@petroules.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Blackberry: Fix QFileSystemEngine::tempPath()Sergio Ahumada2014-02-201-2/+2
| | | | | | | | | | | | Fall back to /var/tmp instead of /tmp if neither TMPDIR nor TEMP are set. /tmp is not a true filesystem on BB10 but rather a symbolic link to /dev/shmem For more info see http://www.qnx.com/developers/docs/6.3.0SP3/neutrino/user_guide/fsystems.html#RAM Change-Id: Ie690ed74ffd81b52ef4623458c3ff88629aee00a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDir::tempPath: make fallback code more readable.David Faure2014-02-101-2/+2
| | | | | | | | This is a no-op because QDir::cleanPath() already takes care of removing the trailing slash. Change-Id: Ic19d9a9dd7e377e04447c3ebc776b025f5f0c43a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Refactor OS X bundle detection for QFileInfoSamuel Gaist2013-10-041-11/+72
| | | | | | | | | | | | | CFBundleGetPackageInfoInDirectory originally used tests for the presence of information that are not mandatory in a bundle. The new implementation uses known bundle extensions as well as Launch Services to try to find if the bundle is known to the system. Last thing it checks whether the package bit is set. Task-number: QTBUG-31884 Change-Id: Ib58996c6ac65194c21238f5f86f78d797e310608 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* Allow QDir::mkpath() to work on QNX QNet pathsMatt Hoosier2013-09-251-1/+8
| | | | | | | | | | | | | | | | Due to a quirk in the way that QNX's mkdir() implementation reports return values when the requested pathname is the mountpoint of a QNet filesystem, the usual recursive directory creation algorithm used by QDir fails if the destination directory happens to exist inside QNet. This is an artificial failure; the desired directory can still be created with the normal mkdir() algorithm. There just needs to error handling in place to allow the recursive creation of parents to recognize this situation. Change-Id: I350fd9cb39858570032f9146c1154a9287701569 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* fix QFileSystemEngine::createDirectory race conditionv5.1.0-rc1Shawn Rutledge2013-06-141-5/+6
| | | | | | | | | | | | | | | | | | | | | | During a call to QDir::mkpath(), the same path could be created by another process, in which case the OS mkdir will fail with EEXIST. But the docs for mkpath() state that it's not an error if it already exists, whereas for mkdir() it is an error. So QFileSystemEngine::createDirectory should accept the EEXIST error silently if it occurs while creating the sequence of parent directories and the final leaf directory, but should fail if EEXIST happens when it was called from QDir::mkdir(), which is when the createParents parameter is false. We assume the operating system mkdir() and CreateDirectory() are atomic, so there should be no race condition in QDir::mkdir(). It's not necessary for mkpath() to call stat() at each level, only to check whether an existing entry is a directory or a file. Also added to the autotest to verify that if the path is an existing file, creating a dir with the same name will fail in either mkdir or mkpath. Task-number: QTBUG-30046 Change-Id: I926352f10654fdf3b322c8685bb85ad8b8844874 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Utilize the new Q_OS_MACX define.Jake Petroules2013-05-091-8/+8
| | | | | | | | | | All occurrences of `#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)` have been replaced with `#if defined(Q_OS_MACX)`. Change-Id: I5055d9bd1845136beb8ed1c79a8f0f2c0897751a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Introducing the Qt Android portPaul Olav Tvete2013-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | Based on the Necessitas project by Bogdan Vatra. Contributors to the Qt5 project: BogDan Vatra <bogdan@kde.org> Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> hjk <hjk121@nokiamail.com> Oswald Buddenhagen <oswald.buddenhagen@digia.com> Paul Olav Tvete <paul.tvete@digia.com> Robin Burchell <robin+qt@viroteck.net> Samuel Rødal <samuel.rodal@digia.com> Yoann Lopes <yoann.lopes@digia.com> The full history of the Qt5 port can be found in refs/old-heads/android, SHA-1 249ca9ca2c7d876b91b31df9434dde47f9065d0d Change-Id: Iff1a7b2dbb707c986f2639e65e39ed8f22430120 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove ifdefs for supporting Mac OS <= 10.5Tor Arne Vestbø2013-02-181-2/+0
| | | | | | | | Qt5 requires Mac OS 10.6, so we can remove checks such as if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 Change-Id: Iea21727a277291148704ecf9677ed0b68c24920f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-281-1/+1
|\ | | | | | | Change-Id: I12b4d8b99bdccae53b1a978cd6eb8f4ac6fb3c76
| * Fixed checking HOME variable return value using isEmpty()Pasi Petäjäjärvi2013-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | Return value of the QFile::decodeName(qgetenv("HOME")); is never null if HOME environment variable is not set. So need to check the return value using isEmpty() instead. Task-number: QTBUG-28912 Change-Id: Ic57b1978d63e99b056cde35ca8cb9d2a07ff8ce8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* | Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Frederik Gladhorn2013-01-231-2/+2
|\| | | | | | | refs/staging/dev
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Store inode numbers in decimal notationThiago Macieira2013-01-181-1/+1
| | | | | | | | | | | | | | | | | | ls(1) with the -i option and stat(1) show inode numbers in decimal. If anyone ever tries debugging this problem, we should present the information that other tools would show too. Change-Id: I54b24edba5b028cc86744ca302ab918f8baa2d2b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* | Use stub functions getpwuid and getgrgid for VxWorksPasi Petäjäjärvi2013-01-231-2/+2
| | | | | | | | | | | | | | | | | | VxWorks has no concepts of users and groups, therefore no such functions exists on VxWorks. Use stub functions from qfunctions_vxworks.h for those, so we don't need to make major source code changes. Change-Id: Iaad80ec18441e3d3e9c0f96e92ccc3766b27d976 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* | Strip prepending <hostname>: string from currentPath() for VxSimPasi Petäjäjärvi2013-01-231-1/+9
|/ | | | | | | | | | VxWorks simulator (VxSim) maps SDK rootdir usable as normal directory. Mapped directory name is either host: or <hostname>: and can be used without prepending prefix containing colon. Strip prepending string and colon to get valid native path to host SDK rootdir running VxSim. Change-Id: I9d2829e32431c2d50fefe55c93780cd37165e565 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Fix renaming of files that differ only in case.Friedemann Kleint2013-01-151-0/+16
| | | | | | | | | | | | | | | | This currently fails on case-insensitive file systems since the check for existence then triggered and indicated "file already exists". Check on the file id (inode or file id) whether the target file is really a different file for a case-changing rename. Task-number: QTBUG-3570 Change-Id: I1b2d40850692e02142ee23d2c753428de00aedc6 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix malloc errors from legacy realpath on Mac OSX.Jeremy Nicholl2013-01-141-2/+9
| | | | | | | | | | | | | Avoid using realpath(X,0) on Mac OSX at all, since even on versions of OSX where realpath(X,0) is supported, we still get the legacy version due to our compiler flags. If we were to change the -mmacosx-version-min to 10.5 or higher then this patch would be safe but unnecessary. Task-number: QTBUG-28282 Change-Id: Iee21003f3e9616482483a05ceee706b476091914 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Fixed: QFileInfo::lastModified() returning wrong value.Markku Heikkila2012-09-131-1/+4
| | | | | | | | | | | | | | | Fixed so that empty QDateTime is returned for non existing file. Fixed also created() and lastRead() to return empty QDateTime for non existing file. QFileSystemEngine::fillMetaData() returned true for non existing files. This was also corrected. Task-number: QTBUG-25811 Change-Id: I523eb99e4405b4b813b2950f85cc646239181d07 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Christian Stromme <christian.stromme@nokia.com>
* QFileSystemEngine: fix realpath() buffer sizeRafael Roquetto2012-09-111-1/+1
| | | | | | | | | realpath() returns at most PATH_MAX _plus_ the terminator. Change-Id: I4c2e3e166a5f476863ad8c6999800e6468535dbe Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QNX: fix call to realpath() on QFileSystemEngineRafael Roquetto2012-09-111-1/+1
| | | | | | | | | | | | QNX6, as opposed to later QNX versions, does not define the behavior of realpath() when the second parameter is NULL. We leave it then for the compiler to decide which implementation to call, by relying on the _POSIX_VERSION_ macro, which in QNX6 happens to evaluate to < 200801L. Change-Id: I3a6d3859858f56b69f0d391384c2703083a01257 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Fix QFileSystemEngine::canonicalName() returning corrupt dataThomas McGuire2012-09-101-2/+7
| | | | | | | | | | | | | | In case of an error when calling realpath(), the return value buffer was uninitalized, but still used. Now the error value is checked to prevent this. Additionally, this fixes a memory leak in the error case. In addition, use the modern version of realpath() on QNX, since it is available there. Change-Id: I0ac83454679619f379df9c482c958789ab31866a Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
* Removing duplicate includesSergio Ahumada2012-09-091-1/+0
| | | | | | | Do not include a header more than once Change-Id: Ia2e5d66e72988ad833cf5177a3f8aa988bf510e9 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Blackberry: Fix QFileSystemEngine::tempPath()Thomas McGuire2012-08-291-2/+5
| | | | | | | | | | Apparently it depends on the user and/or firmware version on whether TMPDIR or TEMP is set, so try both. Additionally, fall back to /tmp if neither is set, as that seems to be present on all devices. Change-Id: Ia49499729df525276e145d2e35e94559eac45c98 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Change coreservices -> iosIan Dean2012-04-191-8/+8
| | | | | | | | Replace "contains(QT_CONFIG, coreservices)" with "!ios" in config files. Replace "QT_NO_CORESERVICES" with "Q_OS_IOS" in source files. Change-Id: Id3b02316b245a24ce550e0b47596d18a4a409e4f Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Add support for iOS.Qt4iOS2012-04-171-0/+5
| | | | | | | | | Provide support for platforms with older implementations of realpath() (eg. iOS). Change-Id: Iec7f73c8014d238ae6a2cb2fa836b36b89ce4ef6 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Fix QFileSystemEngine::tempPath on Blackberry OSRafael Roquetto2012-03-301-0/+7
| | | | | | | | | | Unlike Unix, Blackberry OS stores the location of the temporary directory into the TEMP environment variable. Change-Id: I5905763258ea01541c756361870258b421a00967 Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* QByteArray: deprecate QT_NO_CAST_FROM_BYTEARRAY-protected operatorsMarc Mutz2012-02-261-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QByteArray::operator const {char,void}*() implicit conversions are a source of subtle bugs, so they right- fully can be disabled with QT_NO_CAST_FROM_BYTEARRAY. const char *d = qstring.toLatin1(); // implicit conversion while ( d ) // oops: d points to freed memory // ... But almost no-one ever enabled this macros in the wild and many were bitten by these implicit conversions, so this patch deprecates them. I would have liked to remove them completely, but there are just too many occurrences even in Qt itself to hope to find all conditionally-compiled code that uses these. Also fixes all code that needs to compile under QT_NO_DEPRECATED (in qmake/, src/tools/). I984706452db7d0841620a0f64e179906123f3849 separately deals with the bulk of changes in src/ and examples/. Depends on I5ea1ad3c96d9e64167be53c0c418c7b7dba51f68. Change-Id: I8d47e6c293c80f61c6288c9f8d42fda41afe2267 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Drop file-engine abstraction from public APIJoão Abecasis2012-02-221-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This abstraction imposed serious performance penalties and is being dropped from the public API. In particular, by allowing file names to be arbitrarily hijacked by different file engines, and requiring engines to be instantiated in order to decide, it imposed unnecessary overhead on all file operations. Another flaw in the design with direct impact on performance is how engines have no way to provide (or retain) additional information obtained when querying the filesystem. In many places this has meant repeated operations on the file system, where useful information is immediately discarded to be queried again subsequently. For Qt 4.8 a major refactoring of the code base took place to allow bypassing the file-engine abstraction in select places, with considerable performance gains observed. In Qt 5 it is expected we'll be able to take this further, reaping even more benefits, but the abstraction has to go. [Dropping this now does not preclude that virtual file systems make an appearance in Qt at a later point in Qt 5's lifecycle. Hopefully with a new and improved abstraction.] Forward declarations for QFileExtension(Result) were dropped, as the classes were never used or defined. Tests using "internalized" classes will only fully run on developer builds. QFSFileEngine was removed altogether from exception safety test, as it isn't its intent to test internal API. Change-Id: Ie910e6c2628be202ea9e05366b091d6d529b246b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* realpath(X,0) IS supported on QNX.Nick Ratelle2012-02-081-1/+1
| | | | | | | | | Adds check for Q_OS_QNX to force QFileSystemEntry QFileSystemEngine::canonicalName() use realpath(X, 0) on QNX as well. Change-Id: Id0a32277e6d043753c42101c91a393ebedb48a0a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Inline information about FS case sensitivityJoão Abecasis2012-02-061-5/+0
| | | | | | | | | | | As far as Qt is concerned, this information is static and depends only on the platform. By moving the definition to the header we allow the information to be directly used by the compiler, forgoing the need to export the function to interested users. Change-Id: I43de585391d41204d3c3560ac6e65e5a88aee11c Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Shane Kearns <ext-shane.2.kearns@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Resolve a number of compilation issues with INTEGRITYRolland Dudemaine2011-11-181-0/+4
| | | | | | | | | | | | | | First, #ifdef'ed out getpwuid_r() and getpwgid_r() usage since users/groups support is not in in single-process Posix mode. Also, correct a typo and add missing files to io.pri. Update documentation to disable libtiff which won't compile until ibtiff itself is updated, and add back -no-exceptions in the sample command line. And add a line to compile host tools. Add a dummy QT_OPEN_LARGEFILE definition in qplatformdefs.h since there is code that requires it. Move definition of getGlyph() after the definition of qHash(GlyphAndSubPixelPosition). Merge-request: 2686 Reviewed-by: ossi (cherry picked from commit 8fe04a14b1f3688c9ce0933ebec0c28616595d93) Change-Id: I8fe04a14b1f3688c9ce0933ebec0c28616595d93 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* corelib: Remove Q_WS-macros.Friedemann Kleint2011-10-241-11/+9
| | | | | | | | | | | | | | | | | | | | Q_WS_QPA is the only active code path after merging refactor, other Q_WS-macros are no longer used. Enable compilation without -qpa. - Remove Q_OS_MSDOS, Q_OS_OS2 - Remove Q_WS_QWS - Remove/replace definitions/conditionals of Q_WS_XX - Remove qpa branches from profiles - Replace Q_WS_MAC by Q_OS_MAC - Replace Q_WS_MAC && !Q_WS_QPA by Q_OS_MAC && !QT_NO_CORESERVICES - Similarly in profiles: mac:contains(QT_CONFIG, coreservices) - Replace Q_FS_FAT by Q_OS_WIN Change-Id: Icce5a6c55b052c8f72b3b979ddf31a4f388ea9c9 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Restore Qt4.7 behaviour of QFileInfo::absolute(File)PathShane Kearns2011-09-021-1/+1
| | | | | | | | | | | | | | | | | Many applications relied on the undefined behaviour that the filesystem engines returned clean paths (despite the documentation stating that they may not), and consequently suffered regressions with Qt 4.8. Unix paths are once again cleaned if necessary. Windows/Symbian paths were already cleaned, but now use the utility function to check if a path is dirty, to avoid duplicated code. Task-number: QTBUG-19995 Change-Id: If8c18469f149291c9d079ae3da23bc2087bbd49a Reviewed-on: http://codereview.qt.nokia.com/4154 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* QFileSystemEngine::currentPath(): use QFileSystemEntry() also for the ↵Pino Toscano2011-05-101-1/+1
| | | | | | | | | | | | no-PATH_MAX case ... in the same way as done in the other code path. This makes qmake/QtCore compile again on glibc systems without PATH_MAX (e.g. GNU/Hurd). Merge-request: 1218 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> (cherry picked from commit c8812fe6e642520532d65744caefcea790d59de8)
* Fixes warningsOlivier Goffart2011-05-101-0/+1
| | | | | | | | | | | In QString, it would comlain that: assuming signed overflow does not occur when assuming that (X - c) > X is always false Changing to unsigned comparison fix the warning Others are about unused variables Reviewed-by: Thiago (cherry picked from commit 5e5485809e8c6f8339bb9f19ad71ed623a8b23c7)
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+660
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12