mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Use a special name for stdin/stdout in diagnostics
This commit is contained in:
@@ -78,6 +78,7 @@ public:
|
||||
// See the `operator*` equivalent.
|
||||
return const_cast<File *>(this)->operator->();
|
||||
}
|
||||
|
||||
File *close() {
|
||||
return std::visit(Visitor{[this](std::filebuf &file) {
|
||||
// This is called by the destructor, and an explicit `close`
|
||||
@@ -90,6 +91,14 @@ public:
|
||||
? this
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
char const *c_str(std::string const &path) const {
|
||||
return std::visit(Visitor{[&path](std::filebuf const &) { return path.c_str(); },
|
||||
[](std::streambuf const *buf) {
|
||||
return buf == std::cin.rdbuf() ? "<stdin>" : "<stdout>";
|
||||
}},
|
||||
_file);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // RGBDS_FILE_HPP
|
||||
|
||||
Reference in New Issue
Block a user