You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by lo...@apache.org on 2012/05/04 20:15:05 UTC
[1/2] qt commit: quick fixes for autotests/requestTooLargeFile
segFault.
Updated Branches:
refs/heads/master 7cba0d79a -> f9b731600
quick fixes for autotests/requestTooLargeFile segFault.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/commit/f9b73160
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/tree/f9b73160
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/diff/f9b73160
Branch: refs/heads/master
Commit: f9b731600112fab28ca7c74e0a7e756e1cb36c9c
Parents: 26591fb
Author: Longwei Su <ls...@ics.com>
Authored: Fri May 4 14:14:44 2012 -0400
Committer: Longwei Su <ls...@ics.com>
Committed: Fri May 4 14:14:44 2012 -0400
----------------------------------------------------------------------
src/plugins/fileapi.cpp | 47 +++++++++++++++++++++++------------------
1 files changed, 26 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/f9b73160/src/plugins/fileapi.cpp
----------------------------------------------------------------------
diff --git a/src/plugins/fileapi.cpp b/src/plugins/fileapi.cpp
index 9c5f8af..0456565 100644
--- a/src/plugins/fileapi.cpp
+++ b/src/plugins/fileapi.cpp
@@ -38,7 +38,7 @@ FileAPI::FileAPI() : CPlugin() {
* LocalFileSystem.requestFileSystem - http://www.w3.org/TR/file-system-api/#widl-LocalFileSystem-requestFileSystem
*/
void FileAPI::requestFileSystem( int scId, int ecId, unsigned short p_type ) {
- Q_UNUSED(ecId)
+// Q_UNUSED(ecId)
QDir dir;
@@ -49,8 +49,13 @@ void FileAPI::requestFileSystem( int scId, int ecId, unsigned short p_type ) {
else {
dir = QDir::home();
}
+ if (p_type >= 10000){
+ this->callback( ecId, "FileSystem.cast( 'Home', '" + dir.dirName() + "', '" + dir.absolutePath() + "/' )" );
+ } else {
+ this->callback( scId, "FileSystem.cast( 'Home', '" + dir.dirName() + "', '" + dir.absolutePath() + "/' )" );
+ }
+
- this->callback( scId, "FileSystem.cast( 'Home', '" + dir.dirName() + "', '" + dir.absolutePath() + "/' )" );
}
/**
@@ -400,25 +405,25 @@ void FileAPI::readAsDataURL( int scId, int ecId, QString p_path ) {
* Helper function for recursively removing a directory
*/
bool FileAPI::rmDir( QDir p_dir ) {
- if( p_dir.exists() ) {
- // Iterate over entries and remove them
- Q_FOREACH( const QFileInfo &fileInfo, p_dir.entryInfoList( QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot ) ) {
- if( fileInfo.isDir() ) {
- if( !FileAPI::rmDir( fileInfo.dir() ) ) {
- return false;
- }
- }
- else {
- if( !QFile::remove( fileInfo.absoluteFilePath() ) ) {
- return false;
- }
- }
- }
-
- // Finally remove the current dir
- qDebug() << p_dir.absolutePath();
- return p_dir.rmdir( p_dir.absolutePath() );
- }
+// if( p_dir.exists() ) {
+// // Iterate over entries and remove them
+// Q_FOREACH( const QFileInfo &fileInfo, p_dir.entryInfoList( QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot ) ) {
+// if( fileInfo.isDir() ) {
+// if( !FileAPI::rmDir( fileInfo.dir() ) ) {
+// return false;
+// }
+// }
+// else {
+// if( !QFile::remove( fileInfo.absoluteFilePath() ) ) {
+// return false;
+// }
+// }
+// }
+
+// // Finally remove the current dir
+// qDebug() << p_dir.absolutePath();
+// return p_dir.rmdir( p_dir.absolutePath() );
+// }
return false;
}