@@ -34,19 +34,7 @@ qq.DragAndDrop = function(o) {
3434
3535 if ( entry . isFile ) {
3636 entry . file ( function ( file ) {
37- var name = entry . name ,
38- fullPath = entry . fullPath ,
39- indexOfNameInFullPath = fullPath . indexOf ( name ) ;
40-
41- // remove file name from full path string
42- fullPath = fullPath . substr ( 0 , indexOfNameInFullPath ) ;
43-
44- // remove leading slash in full path string
45- if ( fullPath . charAt ( 0 ) === "/" ) {
46- fullPath = fullPath . substr ( 1 ) ;
47- }
48-
49- file . qqPath = fullPath ;
37+ file . qqPath = extractDirectoryPath ( entry ) ;
5038 droppedFiles . push ( file ) ;
5139 parseEntryPromise . success ( ) ;
5240 } ,
@@ -85,6 +73,22 @@ qq.DragAndDrop = function(o) {
8573 return parseEntryPromise ;
8674 }
8775
76+ function extractDirectoryPath ( entry ) {
77+ var name = entry . name ,
78+ fullPath = entry . fullPath ,
79+ indexOfNameInFullPath = fullPath . lastIndexOf ( name ) ;
80+
81+ // remove file name from full path string
82+ fullPath = fullPath . substr ( 0 , indexOfNameInFullPath ) ;
83+
84+ // remove leading slash in full path string
85+ if ( fullPath . charAt ( 0 ) === "/" ) {
86+ fullPath = fullPath . substr ( 1 ) ;
87+ }
88+
89+ return fullPath ;
90+ }
91+
8892 // Promissory. Guaranteed to read all files in the root of the passed directory.
8993 function getFilesInDirectory ( entry , reader , accumEntries , existingPromise ) {
9094 var promise = existingPromise || new qq . Promise ( ) ,
@@ -304,6 +308,9 @@ qq.DragAndDrop = function(o) {
304308 } ) ;
305309 }
306310 } ) ;
311+
312+ this . _testing = { } ;
313+ this . _testing . extractDirectoryPath = extractDirectoryPath ;
307314} ;
308315
309316qq . DragAndDrop . callbacks = function ( ) {
0 commit comments