MCPcopy Create free account
hub / github.com/ImageEngine/cortex / canRead

Method canRead

src/IECore/ObjectReader.cpp:65–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65bool ObjectReader::canRead( const std::string &fileName )
66{
67 // Ideally we'd like to look inside the file and see if it contains one object only
68 // but for efficiency purposes we'll just try and open the file as a database and
69 // see if that succeeds. We could possibly query the structure of the database and
70 // check that it matches the signature of a one-object cache without needing to
71 // actually read the data.
72 IndexedIOPtr io = nullptr;
73
74 try
75 {
76 if ( FileIndexedIO::canRead( fileName ) )
77 {
78 return true;
79 }
80
81 io = open(fileName);
82 return true;
83 }
84
85 catch (Exception &)
86 {
87 return false;
88 }
89
90}
91
92ObjectPtr ObjectReader::doOperation( const CompoundObject * operands )
93{

Callers 3

testCanReadMethod · 0.45
createMethod · 0.45

Calls

no outgoing calls

Tested by 2

testCanReadMethod · 0.36