From ea160ff7011df4ce5e2fff6d974c2d96dc2e6695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Tue, 19 Aug 2025 17:54:31 +0200 Subject: [PATCH] Unhardcode APPVENDOR here and there This should have been done in a674498a9683. --- resources/meson.build | 6 +++++- resources/powder.template.desktop | 2 +- resources/{save.xml => save.template.xml} | 2 +- src/common/clipboard/Clipboard.h | 3 ++- src/common/platform/Linux.cpp | 4 ++-- 5 files changed, 11 insertions(+), 6 deletions(-) rename resources/{save.xml => save.template.xml} (80%) diff --git a/resources/meson.build b/resources/meson.build index 62c905656..00f321cea 100644 --- a/resources/meson.build +++ b/resources/meson.build @@ -102,7 +102,11 @@ elif host_platform == 'linux' embedded_files += [ [ 'icon_exe_png', rendered_icons['icon_exe'] ], [ 'icon_cps_png', rendered_icons['icon_cps'] ], - [ 'save_xml', files('save.xml') ], + [ 'save_xml', configure_file( + input: 'save.template.xml', + output: 'save.xml', + configuration: conf_data, + ) ], [ 'powder_desktop', configure_file( input: 'powder.template.desktop', output: 'powder.desktop', diff --git a/resources/powder.template.desktop b/resources/powder.template.desktop index fce48c223..496a02429 100644 --- a/resources/powder.template.desktop +++ b/resources/powder.template.desktop @@ -2,7 +2,7 @@ Name=@APPNAME@ Type=Application Comment=@APPCOMMENT@ -MimeType=application/vnd.powdertoy.save;x-scheme-handler/ptsave; +MimeType=application/vnd.@APPVENDOR@.save;x-scheme-handler/ptsave; Categories=Game;Simulation; Exec=@APPEXE@ %u Icon=@APPVENDOR@-@APPEXE@ diff --git a/resources/save.xml b/resources/save.template.xml similarity index 80% rename from resources/save.xml rename to resources/save.template.xml index f2899415b..af1ea08f9 100644 --- a/resources/save.xml +++ b/resources/save.template.xml @@ -1,6 +1,6 @@ - + Powder Toy save diff --git a/src/common/clipboard/Clipboard.h b/src/common/clipboard/Clipboard.h index d7cb2c6cc..5afba512f 100644 --- a/src/common/clipboard/Clipboard.h +++ b/src/common/clipboard/Clipboard.h @@ -2,12 +2,13 @@ #include #include #include "common/String.h" +#include "Config.h" class GameSave; namespace Clipboard { - const ByteString clipboardFormatName = "application/vnd.powdertoy.save"; + const ByteString clipboardFormatName = "application/vnd." + ByteString(APPVENDOR) + ".save"; void SetClipboardData(std::unique_ptr data); const GameSave *GetClipboardData(); void Init(); diff --git a/src/common/platform/Linux.cpp b/src/common/platform/Linux.cpp index 1f8c634e8..dc732a452 100644 --- a/src/common/platform/Linux.cpp +++ b/src/common/platform/Linux.cpp @@ -142,7 +142,7 @@ bool Install() ByteString file = ByteString::Build(APPVENDOR, "-", APPID, ".desktop"); ok = ok && Platform::WriteFile(desktopData, file); ok = ok && Run("installing desktop file", { "xdg-desktop-menu", "install", file }, true); - ok = ok && Run("associating save MIME type with desktop file", { "xdg-mime", "default", file, "application/vnd.powdertoy.save" }, true); + ok = ok && Run("associating save MIME type with desktop file", { "xdg-mime", "default", file, "application/vnd.", APPVENDOR, ".save" }, true); ok = ok && Run("associating ptsave URL scheme with desktop file", { "xdg-mime", "default", file, "x-scheme-handler/ptsave" }, true); Platform::RemoveFile(file); } @@ -157,7 +157,7 @@ bool Install() { ByteString file = ByteString(APPVENDOR) + "-cps.png"; ok = ok && Platform::WriteFile(icon_cps_png.AsCharSpan(), file); - ok = ok && Run("providing file icons for saves and stamps", { "xdg-icon-resource", "install", "--noupdate", "--context", "mimetypes", "--size", "64", file, "application-vnd.powdertoy.save" }, true); + ok = ok && Run("providing file icons for saves and stamps", { "xdg-icon-resource", "install", "--noupdate", "--context", "mimetypes", "--size", "64", file, "application-vnd.", APPVENDOR, ".save" }, true); Platform::RemoveFile(file); } if (ok)