| 121 | } |
| 122 | |
| 123 | bool MacPlatformTools::OnPostProcess(CookingData& data) |
| 124 | { |
| 125 | const auto gameSettings = GameSettings::Get(); |
| 126 | const auto platformSettings = MacPlatformSettings::Get(); |
| 127 | const auto platformDataPath = data.GetPlatformBinariesRoot(); |
| 128 | const auto projectVersion = Editor::Project->Version.ToString(); |
| 129 | const auto appName = GetAppName(); |
| 130 | |
| 131 | // Setup package name (eg. com.company.project) |
| 132 | String appIdentifier = platformSettings->AppIdentifier; |
| 133 | if (EditorUtilities::FormatAppPackageName(appIdentifier)) |
| 134 | return true; |
| 135 | |
| 136 | // Find executable |
| 137 | String executableName; |
| 138 | { |
| 139 | Array<String> files; |
| 140 | FileSystem::DirectoryGetFiles(files, data.NativeCodeOutputPath, TEXT("*"), DirectorySearchOption::TopDirectoryOnly); |
| 141 | for (auto& file : files) |
| 142 | { |
| 143 | if (FileSystem::GetExtension(file).IsEmpty()) |
| 144 | { |
| 145 | executableName = StringUtils::GetFileName(file); |
| 146 | break; |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | // Deploy app icon |
| 152 | TextureData iconData; |
| 153 | if (!EditorUtilities::GetApplicationImage(platformSettings->OverrideIcon, iconData)) |
| 154 | { |
| 155 | String iconFolderPath = data.DataOutputPath / TEXT("Resources"); |
| 156 | String tmpFolderPath = iconFolderPath / TEXT("icon.iconset"); |
| 157 | if (!FileSystem::DirectoryExists(tmpFolderPath)) |
| 158 | FileSystem::CreateDirectory(tmpFolderPath); |
| 159 | String srcIconPath = tmpFolderPath / TEXT("icon_1024x1024.png"); |
| 160 | if (EditorUtilities::ExportApplicationImage(iconData, 1024, 1024, PixelFormat::R8G8B8A8_UNorm, srcIconPath)) |
| 161 | { |
| 162 | LOG(Error, "Failed to export application icon."); |
| 163 | return true; |
| 164 | } |
| 165 | CreateProcessSettings procSettings; |
| 166 | procSettings.HiddenWindow = true; |
| 167 | procSettings.FileName = TEXT("/usr/bin/sips"); |
| 168 | procSettings.WorkingDirectory = tmpFolderPath; |
| 169 | procSettings.Arguments = TEXT("-z 16 16 icon_1024x1024.png --out icon_16x16.png"); |
| 170 | bool failed = false; |
| 171 | failed |= Platform::CreateProcess(procSettings); |
| 172 | procSettings.Arguments = TEXT("-z 32 32 icon_1024x1024.png --out icon_16x16@2x.png"); |
| 173 | failed |= Platform::CreateProcess(procSettings); |
| 174 | procSettings.Arguments = TEXT("-z 32 32 icon_1024x1024.png --out icon_32x32.png"); |
| 175 | failed |= Platform::CreateProcess(procSettings); |
| 176 | procSettings.Arguments = TEXT("-z 64 64 icon_1024x1024.png --out icon_32x32@2x.png"); |
| 177 | failed |= Platform::CreateProcess(procSettings); |
| 178 | procSettings.Arguments = TEXT("-z 128 128 icon_1024x1024.png --out icon_128x128.png"); |
| 179 | failed |= Platform::CreateProcess(procSettings); |
| 180 | procSettings.Arguments = TEXT("-z 256 256 icon_1024x1024.png --out icon_128x128@2x.png"); |
nothing calls this directly
no test coverage detected