Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Generated by gA6:09f:@10.09:6g
- import haxe.io.Path;
- import sys.FileSystem;
- class DatabaseFinder {
- static function main() {
- var path = Path.directory(".");
- findDatabases(path);
- }
- static function findDatabases(path: String) {
- var files = FileSystem.readDirectory(path);
- for (file in files) {
- var filePath = Path.join(path, file);
- if (isDatabaseFile(filePath)) {
- trace("Found database: " + filePath);
- } else if (isDirectory(filePath)) {
- findDatabases(filePath);
- }
- }
- }
- static function isDatabaseFile(filePath: String): Bool {
- return Path.extension(filePath) == "db";
- }
- static function isDirectory(filePath: String): Bool {
- var stat = FileSystem.stat(filePath);
- return stat != null && stat.isDirectory();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement