summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/filemanager.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/library/filemanager.cpp b/library/filemanager.cpp
index 47af1c6..2e5efdd 100644
--- a/library/filemanager.cpp
+++ b/library/filemanager.cpp
@@ -30,2 +30,3 @@
30#include <stdlib.h> 30#include <stdlib.h>
31#include <errno.h>
31#include <sys/stat.h> 32#include <sys/stat.h>
@@ -65,3 +66,3 @@ bool FileManager::saveFile( const DocLnk &f, const QByteArray &data )
65 { 66 {
66 qWarning("open failed"); 67 qWarning( "open failed" );
67 return FALSE; 68 return FALSE;
@@ -71,3 +72,3 @@ bool FileManager::saveFile( const DocLnk &f, const QByteArray &data )
71 //check if every was written 72 //check if every was written
72 if ( total_written != int(data.size()) || !f.writeLink() ) 73 if ( total_written != int( data.size() ) || !f.writeLink() )
73 { 74 {
@@ -76,3 +77,3 @@ bool FileManager::saveFile( const DocLnk &f, const QByteArray &data )
76 } 77 }
77 qDebug("total written %d out of %d", total_written, data.size()); 78 qDebug( "total written %d out of %d", total_written, data.size() );
78 79
@@ -100,3 +101,3 @@ bool FileManager::saveFile( const DocLnk &f, const QString &text )
100 { 101 {
101 qWarning("open failed"); 102 qWarning( "open failed" );
102 return FALSE; 103 return FALSE;
@@ -108,3 +109,3 @@ bool FileManager::saveFile( const DocLnk &f, const QString &text )
108 file.close(); 109 file.close();
109 if ( total_written != int(cstr.length()) || !f.writeLink() ) 110 if ( total_written != int( cstr.length()) || !f.writeLink() )
110 { 111 {
@@ -190,5 +191,5 @@ bool FileManager::copyFile( const AppLnk &src, const AppLnk &dest )
190 // okay now rename the file... 191 // okay now rename the file...
191 if ( !renameFile( fileName.latin1(), dest.file().latin1() ) ) 192 if ( !renameFile( fileName, dest.file() ) )
192 // remove the tmp file, otherwise, it will just lay around... 193 // remove the tmp file, otherwise, it will just lay around...
193 QFile::remove( fileName.latin1() ); 194 QFile::remove( fileName );
194 } 195 }
@@ -196,3 +197,3 @@ bool FileManager::copyFile( const AppLnk &src, const AppLnk &dest )
196 { 197 {
197 QFile::remove( fileName.latin1() ); 198 QFile::remove( fileName );
198 } 199 }
@@ -243,5 +244,5 @@ bool FileManager::copyFile( const QString & src, const QString & dest )
243 struct stat status; 244 struct stat status;
244 if( stat( (const char *) src, &status ) == 0 ) 245 if( stat( QFile::encodeName( src ), &status ) == 0 )
245 { 246 {
246 chmod( (const char *) dest, status.st_mode ); 247 chmod( QFile::encodeName( dest ), status.st_mode );
247 } 248 }
@@ -253,6 +254,5 @@ bool FileManager::renameFile( const QString & src, const QString & dest )
253{ 254{
254 QDir dir( QFileInfo( src ).absFilePath() ); 255 if( rename( QFile::encodeName( src ), QFile::encodeName( dest ) ) == -1);
255 if ( !dir.rename( src, dest ) )
256 { 256 {
257 qWarning( "problem renaming file %s to %s", src, dest ); 257 qWarning( "problem renaming file %s to %s, errno: %d", src.latin1(), dest.latin1(), errno );
258 return false; 258 return false;
@@ -322,6 +322,5 @@ bool FileManager::ensurePathExists( const QString &fn )
322 { 322 {
323 if ( system(("mkdir -p "+fi.filePath())) ) 323 if ( system( ("mkdir -p " + QFile::encodeName( fi.filePath() ) ) ) )
324 return FALSE; 324 return FALSE;
325 } 325 }
326
327 return TRUE; 326 return TRUE;