Commit 4409e123 authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Remove mkdir

parent 61f9c9c4
......@@ -66,37 +66,6 @@ Stream* NativeVFS::open(const std::string& path, const uint32 mode, const bool t
}
}
bool NativeVFS::mkdir(const std::string& path, const bool throw_on_exist)
{
if(path.find('\0') != std::string::npos)
throw MDFN_Error(EINVAL, _("Error creating directory \"%s\": %s"), path.c_str(), _("Null character in path."));
#ifdef WIN32
bool invalid_utf8;
std::u16string u16path = UTF8_to_UTF16(path, &invalid_utf8, true);
if(invalid_utf8)
throw MDFN_Error(EINVAL, _("Error creating directory \"%s\": %s"), path.c_str(), _("Invalid UTF-8"));
if(::_wmkdir((const wchar_t*)u16path.c_str()))
#elif defined HAVE_MKDIR
if(::mkdir(path.c_str(), 0750))
#else
#error "mkdir() missing?!"
#endif
{
ErrnoHolder ene(errno);
if(ene.Errno() != EEXIST || throw_on_exist)
throw MDFN_Error(ene.Errno(), _("Error creating directory \"%s\": %s"), path.c_str(), ene.StrError());
return false;
}
return true;
}
bool NativeVFS::unlink(const std::string& path, const bool throw_on_noent, const CanaryType canary)
{
if(canary != CanaryType::unlink)
......
......@@ -33,7 +33,6 @@ class NativeVFS final : public VirtualFS
virtual ~NativeVFS() override;
virtual Stream* open(const std::string& path, const uint32 mode, const bool throw_on_noent = true, const CanaryType canary = CanaryType::open) override;
virtual bool mkdir(const std::string& path, const bool throw_on_exist = false) override;
virtual bool unlink(const std::string& path, const bool throw_on_noent = false, const CanaryType canary = CanaryType::unlink) override;
virtual void rename(const std::string& oldpath, const std::string& newpath, const CanaryType canary = CanaryType::rename) override;
virtual bool finfo(const std::string& path, FileInfo*, const bool throw_on_noent = true) override;
......
......@@ -72,9 +72,6 @@ class VirtualFS
// Otherwise, will return nullptr if the file doesn't exist/wasn't found.
virtual Stream* open(const std::string& path, const uint32 mode, const bool throw_on_noent = true, const CanaryType canary = CanaryType::open) = 0;
// Returns true if directory was created, false if it already exists(unless throw_on_exist is true).
virtual bool mkdir(const std::string& path, const bool throw_on_exist = false) = 0;
// Returns true if the file was unlinked successfully, false if the file didn't exist(unless throw_on_noent is true), and throws on other errors.
virtual bool unlink(const std::string& path, const bool throw_on_noent = false, const CanaryType canary = CanaryType::unlink) = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment