author | ar <ar> | 2004-06-19 14:27:36 (UTC) |
---|---|---|
committer | ar <ar> | 2004-06-19 14:27:36 (UTC) |
commit | 8beb35ab232bf3f20582cf6d1d00681b8dd8e24d (patch) (side-by-side diff) | |
tree | 4a1eb02423a1053ec9524bb1544893d0686bfbbd | |
parent | 0689d1b607583b9b4ebf55b2180bba99d6008d90 (diff) | |
download | opie-8beb35ab232bf3f20582cf6d1d00681b8dd8e24d.zip opie-8beb35ab232bf3f20582cf6d1d00681b8dd8e24d.tar.gz opie-8beb35ab232bf3f20582cf6d1d00681b8dd8e24d.tar.bz2 |
- ignore ENOENT and EAGAIN in renameFile (bug in system?)
- replace system-call "mkdir..." with QDir::mkdir
-rw-r--r-- | library/filemanager.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/library/filemanager.cpp b/library/filemanager.cpp index 2e5efdd..fbfa1d9 100644 --- a/library/filemanager.cpp +++ b/library/filemanager.cpp @@ -255,7 +255,10 @@ bool FileManager::renameFile( const QString & src, const QString & dest ) if( rename( QFile::encodeName( src ), QFile::encodeName( dest ) ) == -1); { + if ( errno != 2 && errno != 11 ) //ignore ENOENT and EAGAIN - bug in system? + { qWarning( "problem renaming file %s to %s, errno: %d", src.latin1(), dest.latin1(), errno ); return false; } + } return true; } @@ -312,14 +315,13 @@ bool FileManager::exists( const DocLnk &f ) /*! - Ensures that the path \a fn exists, by creating required directories. + Ensures that the path \a fileName exists, by creating required directories. Returns TRUE if successful. */ -bool FileManager::ensurePathExists( const QString &fn ) +bool FileManager::ensurePathExists( const QString &fileName ) { - QFileInfo fi(fn); - fi.setFile( fi.dirPath(TRUE) ); - if ( !fi.exists() ) + QDir directory = QFileInfo( fileName ).dir(); + if ( !directory.exists() ) { - if ( system( ("mkdir -p " + QFile::encodeName( fi.filePath() ) ) ) ) + if ( !directory.mkdir( directory.absPath() ) ) return FALSE; } |