| 1 | // Aseprite |
|---|---|
| 2 | // Copyright (C) 2001-2015, 2017 David Capello |
| 3 | // |
| 4 | // This program is distributed under the terms of |
| 5 | // the End-User License Agreement for Aseprite. |
| 6 | |
| 7 | #ifdef HAVE_CONFIG_H |
| 8 | #include "config.h" |
| 9 | #endif |
| 10 | |
| 11 | #include "app/launcher.h" |
| 12 | |
| 13 | #include "app/i18n/strings.h" |
| 14 | #include "base/exception.h" |
| 15 | #include "base/launcher.h" |
| 16 | #include "fmt/format.h" |
| 17 | #include "ui/alert.h" |
| 18 | |
| 19 | namespace app { |
| 20 | namespace launcher { |
| 21 | |
| 22 | void open_url(const std::string& url) |
| 23 | { |
| 24 | open_file(url); |
| 25 | } |
| 26 | |
| 27 | void open_file(const std::string& file) |
| 28 | { |
| 29 | if (!base::launcher::open_file(file)) |
| 30 | ui::Alert::show(fmt::format(Strings::alerts_cannot_open_file(), file)); |
| 31 | } |
| 32 | |
| 33 | void open_folder(const std::string& file) |
| 34 | { |
| 35 | if (!base::launcher::open_folder(file)) |
| 36 | ui::Alert::show(fmt::format(Strings::alerts_cannot_open_folder(), file)); |
| 37 | } |
| 38 | |
| 39 | } // namespace launcher |
| 40 | } // namespace app |
| 41 |