diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-19 23:46:54 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-19 23:46:54 +0100 |
commit | 4f0be557706eeb1aa7f0584ac6a7f2456a066eea (patch) | |
tree | ba4fc103cb0b889e2e203b569bc188f33d4d6953 /Userland/Libraries/LibGUI/FilePicker.cpp | |
parent | a8e0671344b0d21c9413b7b09423196d5982028e (diff) | |
download | serenity-4f0be557706eeb1aa7f0584ac6a7f2456a066eea.zip |
LibGUI: Remove GUI::FilePicker::file_exists()
I have no idea why this existed but everyone should just use
Core::File::exists() instead. :^)
Diffstat (limited to 'Userland/Libraries/LibGUI/FilePicker.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/FilePicker.cpp | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index ac933f5636..c73697b908 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -26,6 +26,7 @@ #include <AK/Function.h> #include <AK/LexicalPath.h> +#include <LibCore/File.h> #include <LibCore/StandardPaths.h> #include <LibGUI/Action.h> #include <LibGUI/BoxLayout.h> @@ -219,7 +220,7 @@ void FilePicker::on_file_return() { LexicalPath path(String::formatted("{}/{}", m_model->root_path(), m_filename_textbox->text())); - if (FilePicker::file_exists(path.string()) && m_mode == Mode::Save) { + if (Core::File::exists(path.string()) && m_mode == Mode::Save) { auto result = MessageBox::show(this, "File already exists. Overwrite?", "Existing File", MessageBox::Type::Warning, MessageBox::InputType::OKCancel); if (result == MessageBox::ExecCancel) return; @@ -229,20 +230,6 @@ void FilePicker::on_file_return() done(ExecOK); } -bool FilePicker::file_exists(const StringView& path) -{ - struct stat st; - int rc = stat(path.to_string().characters(), &st); - if (rc < 0) { - if (errno == ENOENT) - return false; - } - if (rc == 0) { - return true; - } - return false; -} - void FilePicker::set_path(const String& path) { auto new_path = LexicalPath(path).string(); |