| 50 | | |
|---|
| | 61 | static String[] listDirCached(char[] path) |
|---|
| | 62 | { |
|---|
| | 63 | if ((path in directoryCacheExpire) && (std.date.getUTCtime() < directoryCacheExpire[path])) { |
|---|
| | 64 | return directoryCache[path]; |
|---|
| | 65 | } |
|---|
| | 66 | //writefln("DirCache %s expired", path); |
|---|
| | 67 | directoryCache[path] = Path.listDir(path); |
|---|
| | 68 | directoryCacheExpire[path] = std.date.getUTCtime() + (60 * 5* 1000); // 5 minutes? |
|---|
| | 69 | return directoryCache[path]; |
|---|
| | 70 | |
|---|
| | 71 | } |
|---|
| | 72 | |
|---|
| | 73 | static bool checkPathIsDir(String pathS) |
|---|
| | 74 | { |
|---|
| | 75 | char[] path = pathS.toString(); |
|---|
| | 76 | if ((path in checkPaths) && |
|---|
| | 77 | (path in checkPathsExpire) && |
|---|
| | 78 | (std.date.getUTCtime() < checkPathsExpire[path])) { |
|---|
| | 79 | return checkPaths[path]; |
|---|
| | 80 | } |
|---|
| | 81 | if (Path.exists(new String(path)) && Path.isDir(new String(path))) { |
|---|
| | 82 | checkPaths[path] = true; |
|---|
| | 83 | } else { |
|---|
| | 84 | checkPaths[path] = false; |
|---|
| | 85 | } |
|---|
| | 86 | writefln("checkPathIsDir %s expired %d < %d", path, std.date.getUTCtime() , |
|---|
| | 87 | (path in checkPathsExpire) ? checkPathsExpire[path] : 0); |
|---|
| | 88 | checkPathsExpire[path] = std.date.getUTCtime() + (60 * 5 * 1000); // 5 minutes? |
|---|
| | 89 | return checkPaths[path]; |
|---|
| | 90 | } |
|---|
| | 91 | static bool checkPathIsFile(String pathS) |
|---|
| | 92 | { |
|---|
| | 93 | char[] path = pathS.toString(); |
|---|
| | 94 | if ((path in checkPathsFile) && |
|---|
| | 95 | (path in checkPathsExpire) && |
|---|
| | 96 | (std.date.getUTCtime() < checkPathsExpire[path])) { |
|---|
| | 97 | return checkPathsFile[path]; |
|---|
| | 98 | } |
|---|
| | 99 | if (Path.exists(new String(path)) && !Path.isDir(new String(path))) { |
|---|
| | 100 | checkPathsFile[path] = true; |
|---|
| | 101 | } else { |
|---|
| | 102 | checkPathsFile[path] = false; |
|---|
| | 103 | } |
|---|
| | 104 | //writefln("checkPathIsFile %s expired", path); |
|---|
| | 105 | checkPathsExpire[path] = std.date.getUTCtime() + (60 * 5 * 1000); // 5 minutes? |
|---|
| | 106 | return checkPathsFile[path]; |
|---|
| | 107 | } |
|---|