mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-04 23:37:10 +02:00
In FileLister::browse, declare variables when they are needed
This commit is contained in:
parent
2c76ddae50
commit
90a5f82b92
@ -83,27 +83,24 @@ void FileLister::browse(const string& path, bool clean)
|
||||
directories.clear();
|
||||
files.clear();
|
||||
|
||||
DIR *dirp;
|
||||
string slashedPath = path;
|
||||
if (path[path.length() - 1] != '/')
|
||||
slashedPath.push_back('/');
|
||||
|
||||
DIR *dirp;
|
||||
if ((dirp = opendir(slashedPath.c_str())) == NULL) {
|
||||
ERROR("Unable to open directory: %s\n", slashedPath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
string filepath, file;
|
||||
struct stat st;
|
||||
struct dirent *dptr;
|
||||
|
||||
while ((dptr = readdir(dirp))) {
|
||||
file = dptr->d_name;
|
||||
while (struct dirent *dptr = readdir(dirp)) {
|
||||
string file = dptr->d_name;
|
||||
|
||||
if (file[0] == '.' && file != "..")
|
||||
continue;
|
||||
|
||||
filepath = slashedPath + file;
|
||||
string filepath = slashedPath + file;
|
||||
struct stat st;
|
||||
int statRet = stat(filepath.c_str(), &st);
|
||||
if (statRet == -1) {
|
||||
ERROR("Stat failed on '%s' with error '%s'\n", filepath.c_str(), strerror(errno));
|
||||
|
Loading…
Reference in New Issue
Block a user