IO: don't try to load a directory in Filesystem::open
parent
1d45aba0e5
commit
92fc77e8b6
|
@ -87,7 +87,7 @@ ImagePtr loadImage(const core::String& filename, bool async) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!file) {
|
||||
if (!file->validHandle()) {
|
||||
return createEmptyImage(filename);
|
||||
}
|
||||
return loadImage(file, async);
|
||||
|
|
|
@ -416,6 +416,9 @@ bool Filesystem::pushDir(const core::String &directory) {
|
|||
}
|
||||
|
||||
io::FilePtr Filesystem::open(const core::String &filename, FileMode mode) const {
|
||||
if (isReadableDir(filename)) {
|
||||
return core::make_shared<io::File>("", mode);
|
||||
}
|
||||
if (mode == FileMode::SysWrite) {
|
||||
Log::debug("Use absolute path to open file %s for writing", filename.c_str());
|
||||
return core::make_shared<io::File>(filename, mode);
|
||||
|
|
Loading…
Reference in New Issue