1 |
/*************************************************************************** |
/*************************************************************************** |
2 |
* * |
* * |
3 |
* Copyright (C) 2007 Grigor Iliev * |
* Copyright (C) 2007, 2008 Grigor Iliev * |
4 |
* * |
* * |
5 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
6 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
27 |
#include <vector> |
#include <vector> |
28 |
#include <gig.h> |
#include <gig.h> |
29 |
#include <sqlite3.h> |
#include <sqlite3.h> |
30 |
#include <sys/stat.h> |
|
31 |
|
#include "../common/File.h" |
32 |
|
|
33 |
namespace LinuxSampler { |
namespace LinuxSampler { |
34 |
|
|
361 |
int GetFileCount(); |
int GetFileCount(); |
362 |
}; |
}; |
363 |
|
|
364 |
class DirectoryScanner { |
class DirectoryScanner: public File::DirectoryWalker { |
365 |
public: |
public: |
366 |
/** |
/** |
367 |
* Recursively scans all subdirectories of the specified file |
* Recursively scans all subdirectories of the specified file |
369 |
* @param pProgress The progress used to monitor the scan process. |
* @param pProgress The progress used to monitor the scan process. |
370 |
* @throws Exception - if the specified directories are invalid. |
* @throws Exception - if the specified directories are invalid. |
371 |
*/ |
*/ |
372 |
static void Scan(String DbDir, String FsDir, bool Flat, ScanProgress* pProgress = NULL); |
void Scan(String DbDir, String FsDir, bool Flat, ScanProgress* pProgress = NULL); |
373 |
|
|
374 |
|
virtual void DirectoryEntry(std::string Path); |
375 |
|
virtual void FileEntry(std::string Path) { } |
376 |
|
|
377 |
private: |
private: |
378 |
static String DbDir; |
String DbDir; |
379 |
static String FsDir; |
String FsDir; |
380 |
static bool Flat; |
bool Flat; |
381 |
static ScanProgress* pProgress; |
ScanProgress* pProgress; |
382 |
static int FtwCallback(const char* fpath, const struct stat* sb, int typeflag); |
bool HasInstrumentFiles(String Dir); |
|
static bool HasInstrumentFiles(String Dir); |
|
383 |
}; |
}; |
384 |
|
|
385 |
class InstrumentFileCounter { |
class InstrumentFileCounter: public File::DirectoryWalker { |
386 |
public: |
public: |
387 |
/** |
/** |
388 |
* Recursively scans all subdirectories of the specified file |
* Recursively scans all subdirectories of the specified file |
390 |
* @param FsDir The file system directory to process. |
* @param FsDir The file system directory to process. |
391 |
* @throws Exception - if the specified directory is invalid. |
* @throws Exception - if the specified directory is invalid. |
392 |
*/ |
*/ |
393 |
static int Count(String FsDir); |
int Count(String FsDir); |
394 |
|
|
395 |
static int FtwCallback(const char* fpath, const struct stat* sb, int typeflag); |
virtual void DirectoryEntry(std::string Path) { } |
396 |
|
virtual void FileEntry(std::string Path); |
397 |
|
|
398 |
private: |
private: |
399 |
static int FileCount; |
int FileCount; |
400 |
}; |
}; |
401 |
|
|
402 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |