mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-11 14:12:26 -05:00
If caching is disabled, still cache theme info and images in a temporary directory (which will be deleted once rbutil is closed) to prevent downling them every time the theme selection changes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14704 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e6b8347a4d
commit
554f0c3771
7 changed files with 106 additions and 37 deletions
45
rbutil/rbutilqt/utils.cpp
Normal file
45
rbutil/rbutilqt/utils.cpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id$
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
// recursive function to delete a dir with files
|
||||
bool recRmdir( const QString &dirName )
|
||||
{
|
||||
QString dirN = dirName;
|
||||
QDir dir(dirN);
|
||||
QStringList list = dir.entryList(QDir::AllEntries); // make list of entries in directory
|
||||
QFileInfo fileInfo;
|
||||
QString curItem, lstAt;
|
||||
for(int i = 0; i < list.size(); i++){ // loop through all items of list
|
||||
QString name = list.at(i);
|
||||
if(!(name == ".") && !(name == "..")){
|
||||
curItem = dirN + "/" + name;
|
||||
fileInfo.setFile(curItem);
|
||||
if(fileInfo.isDir()) // is directory
|
||||
recRmdir(curItem); // call recRmdir() recursively for deleting subdirectory
|
||||
else // is file
|
||||
QFile::remove(curItem); // ok, delete file
|
||||
}
|
||||
}
|
||||
dir.cdUp();
|
||||
return dir.rmdir(dirN); // delete empty dir and return if (now empty) dir-removing was successfull
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue