-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
207 additions
and
62 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
import 'package:path/path.dart' as path; | ||
import 'dart:io' show Directory, File, FileSystemEntity, FileSystemEntityType; | ||
|
||
filesInDirectoryWithDepth(Directory dir, FileSystemEntityType typ, | ||
int currentLevel, int maxLevel) { | ||
final days = new DateTime.now().subtract(new Duration(days: 90)); | ||
if ([ | ||
"Documents", | ||
"Applications", | ||
"Desktop", | ||
"Movies", | ||
"Music", | ||
"Pictures", | ||
"Public" | ||
].indexOf(path.basename(dir.path)) != | ||
-1) { | ||
return; | ||
} | ||
|
||
if (path.basename(dir.path) == ".virtualenvs" && | ||
dir.statSync().accessed.isBefore(days)) { | ||
|
||
return dir; | ||
} | ||
if (currentLevel > maxLevel) { | ||
return; | ||
} else { | ||
try { | ||
for (FileSystemEntity entity | ||
in dir.listSync(recursive: false, followLinks: false)) { | ||
FileSystemEntityType type = | ||
FileSystemEntity.typeSync(entity.path, followLinks: false); | ||
if (type == typ) { | ||
if (path.basename(entity.path) == ".virtualenvs") { | ||
|
||
return entity; | ||
} | ||
if ([ | ||
"Documents", | ||
"Applications", | ||
"Desktop", | ||
"Movies", | ||
"Music", | ||
"Pictures", | ||
"Public" | ||
].indexOf(path.basename(dir.path)) != | ||
-1) { | ||
continue; | ||
} | ||
filesInDirectoryWithDepth( | ||
entity, typ, currentLevel + 1, maxLevel); | ||
} | ||
} | ||
} catch (e) {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import 'package:path/path.dart' as path; | ||
import 'dart:io' show Directory, File, FileSystemEntity, FileSystemEntityType; | ||
import 'dart:isolate'; | ||
|
||
final RegExp re = new RegExp(r'\.rvm/gems/ruby\-(\d+\.\d+(?:\.\d+)?)/gems'); | ||
|
||
filesInDirectoryWithDepth(Directory dir, FileSystemEntityType typ, | ||
int currentLevel, int maxLevel,SendPort sendPort) { | ||
|
||
if ([ | ||
"Documents", | ||
"Applications", | ||
"Desktop", | ||
"Movies", | ||
"Music", | ||
"Pictures", | ||
"Public" | ||
].indexOf(path.basename(dir.path)) != | ||
-1) { | ||
return; | ||
} | ||
|
||
if (re.hasMatch(dir.path) ) { | ||
sendPort.send(dir); | ||
|
||
return; | ||
} | ||
if (currentLevel > maxLevel) { | ||
return; | ||
} else { | ||
try { | ||
for (FileSystemEntity entity | ||
in dir.listSync(recursive: false, followLinks: false)) { | ||
FileSystemEntityType type = | ||
FileSystemEntity.typeSync(entity.path, followLinks: false); | ||
if (type == typ) { | ||
if (re.hasMatch(entity.path)) { | ||
sendPort.send(entity); | ||
|
||
return; | ||
} | ||
if ([ | ||
"Documents", | ||
"Applications", | ||
"Desktop", | ||
"Movies", | ||
"Music", | ||
"Pictures", | ||
"Public" | ||
].indexOf(path.basename(dir.path)) != | ||
-1) { | ||
return; | ||
} | ||
filesInDirectoryWithDepth( | ||
entity, typ, currentLevel + 1, maxLevel,sendPort); | ||
} | ||
} | ||
} catch (e) {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters