| 140 | |
| 141 | |
| 142 | std::istream *openFile(std::string const& filename, bool asBinary) |
| 143 | { |
| 144 | if (filename[0] == '~') |
| 145 | throw pdal::pdal_error("PDAL does not support shell expansion"); |
| 146 | |
| 147 | VSI::VSIIStream *ifs = nullptr; |
| 148 | |
| 149 | std::string name(filename); |
| 150 | if (isStdin(name)) |
| 151 | name = "/vsistdin/"; |
| 152 | |
| 153 | if (!FileUtils::fileExists(name)) |
| 154 | return nullptr; |
| 155 | |
| 156 | std::ios::openmode mode = std::ios::in; |
| 157 | if (asBinary) |
| 158 | mode |= std::ios::binary; |
| 159 | |
| 160 | ifs = new Utils::ClassicLocaleStream<VSI::VSIIStream>(name, mode); |
| 161 | |
| 162 | if (!ifs->good()) |
| 163 | { |
| 164 | delete ifs; |
| 165 | return nullptr; |
| 166 | } |
| 167 | return ifs; |
| 168 | } |
| 169 | |
| 170 | |
| 171 | std::ostream *createFile(std::string const& name, bool asBinary) |
no test coverage detected