ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/XmlTools2/trunk/util.cpp
(Generate patch)

Comparing XmlTools2/trunk/util.cpp (file contents):
Revision 920 by s10k, Sun Feb 2 18:50:10 2014 UTC vs.
Revision 923 by s10k, Mon Feb 3 15:42:14 2014 UTC

# Line 170 | Line 170 | QStringList getAllFilesByWildcard(const
170  
171      QString pathNormalized;
172      QStringList nameWildCard; // entryList requires a QStringList
173 +    QStringList resultFiles; // result files with absolute path
174      int endOfPathIdx;
175      QDir directory;
176  
# Line 180 | Line 181 | QStringList getAllFilesByWildcard(const
181  
182      pathNormalized=Util::normalizePath(wildcard); // Convert slashes to work in both mac and windows
183  
184 <    if(pathNormalized.contains("/")){
184 >    if(pathNormalized.contains("/")){ // If contains full path
185          endOfPathIdx=Util::indexOfBackward(pathNormalized,"/"); // get last slash
186  
187          nameWildCard.append(pathNormalized.right(pathNormalized.size()-1-endOfPathIdx)); // get the names wildcard // -1 because starts with zeo
# Line 188 | Line 189 | QStringList getAllFilesByWildcard(const
189          pathNormalized=pathNormalized.left(endOfPathIdx); // get the complete path
190  
191          directory=QDir(pathNormalized);
192 <
193 <        return directory.entryList(nameWildCard);
192 >    }
193 >    else{ // if relative
194 >        nameWildCard << wildcard;
195      }
196  
197 <    nameWildCard << wildcard;
197 >    foreach (QFileInfo fileInfo, directory.entryInfoList(nameWildCard)){
198 >        resultFiles << fileInfo.absoluteFilePath();
199 >    }
200  
201 <    return directory.entryList(nameWildCard);
201 >    return resultFiles;
202   }
203  
204   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)