diff options
| author | 2023-10-16 23:50:09 -0300 | |
|---|---|---|
| committer | 2023-10-16 23:50:09 -0300 | |
| commit | fc4b45ebd344a3e3d571b8516e73cd9afe824a9b (patch) | |
| tree | eaaeb45cac8c9a2db31f1f4198a9eb77d28eb514 /src | |
| parent | More @liamwhite suggestions applied. (diff) | |
| download | yuzu-fc4b45ebd344a3e3d571b8516e73cd9afe824a9b.tar.gz yuzu-fc4b45ebd344a3e3d571b8516e73cd9afe824a9b.tar.xz yuzu-fc4b45ebd344a3e3d571b8516e73cd9afe824a9b.zip | |
Moved check.
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 75fbd042a..0e0d7ef0e 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -2847,6 +2847,13 @@ bool GMainWindow::CreateShortcutLink(const std::filesystem::path& shortcut_path, | |||
| 2847 | const std::string& arguments, const std::string& categories, | 2847 | const std::string& arguments, const std::string& categories, |
| 2848 | const std::string& keywords, const std::string& name) try { | 2848 | const std::string& keywords, const std::string& name) try { |
| 2849 | 2849 | ||
| 2850 | #if defined(__linux__) || defined(__FreeBSD__) || defined(_WIN32) // Linux, FreeBSD and Windows | ||
| 2851 | // Plus 'name' is required | ||
| 2852 | if (name.empty()) { | ||
| 2853 | LOG_ERROR(Frontend, "Name is empty"); | ||
| 2854 | return false; | ||
| 2855 | } | ||
| 2856 | |||
| 2850 | // Copy characters if they are not illegal in Windows filenames | 2857 | // Copy characters if they are not illegal in Windows filenames |
| 2851 | std::string filename = ""; | 2858 | std::string filename = ""; |
| 2852 | const std::string illegal_chars = "<>:\"/\\|?*"; | 2859 | const std::string illegal_chars = "<>:\"/\\|?*"; |
| @@ -2865,17 +2872,12 @@ bool GMainWindow::CreateShortcutLink(const std::filesystem::path& shortcut_path, | |||
| 2865 | } | 2872 | } |
| 2866 | 2873 | ||
| 2867 | std::filesystem::path shortcut_path_full = shortcut_path / filename; | 2874 | std::filesystem::path shortcut_path_full = shortcut_path / filename; |
| 2875 | #endif | ||
| 2868 | 2876 | ||
| 2869 | #if defined(__linux__) || defined(__FreeBSD__) // Linux and FreeBSD | 2877 | #if defined(__linux__) || defined(__FreeBSD__) // Linux and FreeBSD |
| 2870 | // Reference for the desktop file template: | 2878 | // Reference for the desktop file template: |
| 2871 | // https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html | 2879 | // https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html |
| 2872 | 2880 | ||
| 2873 | // Plus 'Type' is required | ||
| 2874 | if (name.empty()) { | ||
| 2875 | LOG_ERROR(Frontend, "Name is empty"); | ||
| 2876 | return false; | ||
| 2877 | } | ||
| 2878 | |||
| 2879 | // Append .desktop extension | 2881 | // Append .desktop extension |
| 2880 | shortcut_path_full += ".desktop"; | 2882 | shortcut_path_full += ".desktop"; |
| 2881 | 2883 | ||