diff --git a/plugin-dev/Sentry.uplugin b/plugin-dev/Sentry.uplugin index 755f79c87..9f83b44fe 100644 --- a/plugin-dev/Sentry.uplugin +++ b/plugin-dev/Sentry.uplugin @@ -31,7 +31,8 @@ "PreBuildSteps": { "Mac": [ - "if [ -f \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" ]; then\n chmod +x \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" \nfi" + "if [ -f \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" ]; then\n chmod +x \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" \nfi", + "if [ -f \"$(PluginDir)/Source/ThirdParty/CLI/sentry-cli-Darwin-universal\" ]; then\n chmod +x \"$(PluginDir)/Source/ThirdParty/CLI/sentry-cli-Darwin-universal\" \nfi" ] }, "PostBuildSteps": @@ -44,9 +45,11 @@ "if [ -f \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" ]; then\n \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" $(TargetPlatform) $(TargetName) $(TargetType) $(TargetConfiguration) \"$(ProjectDir)\" \"$(PluginDir)\"\nelse\n echo \"Sentry: Symbol upload script is missing. Skipping post build step.\"\nfi" ], "Win64": [ - "setlocal enabledelayedexpansion", - "set \"CRASHPAD_HANDLER=$(PluginDir)/Binaries/Linux/crashpad_handler\"", - "if \"$(TargetPlatform)\"==\"Linux\" (\n if not exist \"%CRASHPAD_HANDLER%\" (xcopy \"$(PluginDir)/Source/ThirdParty/Linux/bin/*\" \"$(PluginDir)/Binaries/Linux/\" /F /R /Y /I)\n)", + "setlocal enabledelayedexpansion", + "set \"CRASHPAD_HANDLER_LINUX=$(PluginDir)/Binaries/Linux/crashpad_handler\"", + "if \"$(TargetPlatform)\"==\"Linux\" (\n if not exist \"%CRASHPAD_HANDLER_LINUX%\" (xcopy \"$(PluginDir)/Source/ThirdParty/Linux/bin/*\" \"$(PluginDir)/Binaries/Linux/\" /F /R /Y /I)\n)", + "set \"CRASHPAD_HANDLER_WIN=$(PluginDir)/Binaries/Win64/crashpad_handler.exe\"", + "if \"$(TargetPlatform)\"==\"Win64\" (\n if not exist \"%CRASHPAD_HANDLER_WIN%\" (xcopy \"$(PluginDir)/Source/ThirdParty/Win64/Crashpad/bin/*\" \"$(PluginDir)/Binaries/Win64/\" /F /R /Y /I)\n)", "set \"SYM_UPLOAD_SCRIPT=$(PluginDir)/Scripts/upload-debug-symbols-win.bat\"", "if exist \"%SYM_UPLOAD_SCRIPT%\" (call \"%SYM_UPLOAD_SCRIPT%\" $(TargetPlatform) $(TargetName) $(TargetType) $(TargetConfiguration) \"$(ProjectDir)\" \"$(PluginDir)\") else (\necho Warning: Sentry: Symbol upload script is missing. Skipping post build step.\n)", "endlocal" diff --git a/plugin-dev/Source/Sentry/Private/SentryModule.cpp b/plugin-dev/Source/Sentry/Private/SentryModule.cpp index ba78a0a37..4481dab2e 100644 --- a/plugin-dev/Source/Sentry/Private/SentryModule.cpp +++ b/plugin-dev/Source/Sentry/Private/SentryModule.cpp @@ -16,8 +16,6 @@ const FName FSentryModule::ModuleName = "Sentry"; -const bool FSentryModule::IsMarketplace = false; - void FSentryModule::StartupModule() { // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module @@ -117,7 +115,16 @@ FString FSentryModule::GetPluginVersion() bool FSentryModule::IsMarketplaceVersion() { - return IsMarketplace; + // Marketplace version check heuristic: + // In case the plugin installed via Epic Games launcher path to its base dir supposed to be /Plugins/Marketplace/Sentry + // This approach is not foolproof as users may manually copy plugin to this location + + const FString PluginPath = FPaths::ConvertRelativePathToFull( + IPluginManager::Get().FindPlugin(TEXT("Sentry"))->GetBaseDir()); + const FString MarketplacePrefix = FPaths::ConvertRelativePathToFull( + FPaths::Combine(FPaths::EnginePluginsDir(), TEXT("Marketplace"))); + + return PluginPath.StartsWith(MarketplacePrefix); } #if PLATFORM_MAC diff --git a/scripts/packaging/pack.ps1 b/scripts/packaging/pack.ps1 index dce24d625..cb965125a 100644 --- a/scripts/packaging/pack.ps1 +++ b/scripts/packaging/pack.ps1 @@ -32,24 +32,6 @@ function packFiles([string] $publishingPlatform) Copy-Item "CHANGELOG.md" -Destination "package-release-$publishingPlatform/CHANGELOG.md" Copy-Item "LICENSE" -Destination "package-release-$publishingPlatform/LICENSE" - if ($publishingPlatform -eq "marketplace") - { - # Workaround for PowerShell 5.1 writing UTF8-BOM - # ====== - # Set current directory so that ::WriteAllLines can accept a relative path - [System.Environment]::CurrentDirectory = (Get-Location).Path - - # Find the specific package version of the SentryModule.cpp file - $sentryModuleCppPath = "package-release-$publishingPlatform/Source/Sentry/Private/SentryModule.cpp" - - # We know the file is meant to be UTF8, so let's be explicit - $sentryModuleCppContents = Get-Content $sentryModuleCppPath -Encoding UTF8 - $replacedCppContents = $sentryModuleCppContents -replace 'FSentryModule::IsMarketplace = false', 'FSentryModule::IsMarketplace = true' - - # PowerShell 5.1 will write UT8-BOM if we use Out-File, so bypass this issue and use ::WriteAllLines - [System.IO.File]::WriteAllLines($sentryModuleCppPath, $replacedCppContents) - } - $pluginSpec = Get-Content "plugin-dev/Sentry.uplugin" $version = [regex]::Match("$pluginSpec", '"VersionName": "([^"]+)"').Groups[1].Value $engineVersions = Get-Content $PSScriptRoot/engine-versions.txt