Unhardcode APPVENDOR here and there

This should have been done in a674498a96.
This commit is contained in:
Tamás Bálint Misius
2025-08-19 17:54:31 +02:00
parent 21b533ae47
commit ea160ff701
5 changed files with 11 additions and 6 deletions

View File

@@ -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',

View File

@@ -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@

View File

@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/vnd.powdertoy.save">
<mime-type type="application/vnd.@APPVENDOR@.save">
<comment>Powder Toy save</comment>
<glob pattern="*.cps"/>
<glob pattern="*.stm"/>

View File

@@ -2,12 +2,13 @@
#include <memory>
#include <optional>
#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<GameSave> data);
const GameSave *GetClipboardData();
void Init();

View File

@@ -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)