| 1 |
{ |
| 2 |
Copyright 2014-2022 Michalis Kamburelis. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in this distribution, for details about the copyright. |
| 8 |
|
| 9 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
|
| 13 |
---------------------------------------------------------------------------- |
| 14 |
} |
| 15 |
|
| 16 |
{ Packaging format. } |
| 17 |
unit ToolPackageFormat; |
| 18 |
|
| 19 |
{$I castleconf.inc} |
| 20 |
|
| 21 |
interface |
| 22 |
|
| 23 |
type |
| 24 |
TPackageFormat = ( |
| 25 |
pfDefault, |
| 26 |
pfDirectory, |
| 27 |
pfZip, |
| 28 |
pfTarGz, |
| 29 |
pfDeb, |
| 30 |
pfAndroidApk, |
| 31 |
pfAndroidAppBundle, |
| 32 |
pfIosXcodeProject, |
| 33 |
pfIosArchiveDevelopment, |
| 34 |
pfIosArchiveAdHoc, |
| 35 |
pfIosArchiveAppStore, |
| 36 |
pfNintendoSwitchProject, |
| 37 |
pfMacAppBundle, |
| 38 |
pfMacAppBundleZip |
| 39 |
); |
| 40 |
TPackageFormatNoDefault = pfDirectory..High(TPackageFormat); |
| 41 |
|
| 42 |
function PackageFormatToString(const O: TPackageFormat): String; |
| 43 |
function StringToPackageFormat(const S: String): TPackageFormat; |
| 44 |
|
| 45 |
implementation |
| 46 |
|
| 47 |
uses SysUtils; |
| 48 |
|
| 49 |
const |
| 50 |
PackageFormatNames: array [TPackageFormat] of String = ( |
| 51 |
'default', |
| 52 |
'directory', |
| 53 |
'zip', |
| 54 |
'targz', |
| 55 |
'deb', |
| 56 |
'android-apk', |
| 57 |
'android-app-bundle', |
| 58 |
'ios-xcode-project', |
| 59 |
'ios-archive-development', |
| 60 |
'ios-archive-ad-hoc', |
| 61 |
'ios-archive-app-store', |
| 62 |
'nintendo-switch-project', |
| 63 |
'mac-app-bundle', |
| 64 |
'mac-app-bundle-zip' |
| 65 |
); |
| 66 |
|
| 67 |
function PackageFormatToString(const O: TPackageFormat): String; |
| 68 |
begin |
| 69 |
Result := PackageFormatNames[O]; |
| 70 |
end; |
| 71 |
|
| 72 |
function StringToPackageFormat(const S: String): TPackageFormat; |
| 73 |
begin |
| 74 |
for Result := Low(TPackageFormat) to High(TPackageFormat) do |
| 75 |
if AnsiSameText(PackageFormatNames[Result], S) then |
| 76 |
Exit; |
| 77 |
raise Exception.CreateFmt('Invalid package-format name "%s"', [S]); |
| 78 |
end; |
| 79 |
|
| 80 |
end. |