| 36 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
| 37 | |
| 38 | bool Foam::Time::exists(IOobject& io) |
| 39 | { |
| 40 | // Generate filename for object |
| 41 | fileName objPath(fileHandler().objectPath(io, word::null)); |
| 42 | |
| 43 | // Test for either directory or a (valid) file & IOobject |
| 44 | bool ok; |
| 45 | if (io.name().empty()) |
| 46 | { |
| 47 | ok = fileHandler().isDir(objPath); |
| 48 | } |
| 49 | else |
| 50 | { |
| 51 | ok = |
| 52 | fileHandler().isFile(objPath) |
| 53 | && io.typeHeaderOk<IOList<label>>(false);// object with local scope |
| 54 | } |
| 55 | |
| 56 | if (!ok) |
| 57 | { |
| 58 | // Re-test with raw objectPath. This is for backwards |
| 59 | // compatibility |
| 60 | fileName originalPath(io.objectPath()); |
| 61 | if (originalPath != objPath) |
| 62 | { |
| 63 | // Test for either directory or a (valid) file & IOobject |
| 64 | if (io.name().empty()) |
| 65 | { |
| 66 | ok = fileHandler().isDir(originalPath); |
| 67 | } |
| 68 | else |
| 69 | { |
| 70 | ok = |
| 71 | fileHandler().isFile(originalPath) |
| 72 | && io.typeHeaderOk<IOList<label>>(false); |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | return ok; |
| 78 | } |
| 79 | |
| 80 | |
| 81 | Foam::word Foam::Time::findInstance |
no test coverage detected