Turns out it's the ":" in ApplicationTitle "ZGameEditor: FileDemo" that breaks the build because it uses the same name for the filename and the name of the application.BUILD FAILED
C:\Android\android-sdk-windows\tools\ant\build.xmlThe following error occurred while executing this line:
C:\Android\android-sdk-windows\tools\ant\build.xmlValue for 'output' is not valid. It must resolve to a single path
The file name is used in build.xml:
<project name="$title$" default="help">
While the application name is listed in AndroidManifest.xml:
android:label="$title$"
Is it possible to sanitize the filename for build.xml and have an untouched application name for AndroidManifest.xml?
From what I understand, we just need to add a line in frmEditor.pas:
Code: Select all
try
Lookups.Add('$sdkpath$', StringReplace(Self.AndroidSdkPath,'\','/',[rfReplaceAll]) );
Lookups.Add('$sdkpath_normal$',Self.AndroidSdkPath);
Lookups.Add('$package$', String(Self.ZApp.AndroidPackageName) );
Lookups.Add('$title$', String(Self.ZApp.Caption) );
Lookups.Add('$versionname$', String(Self.ZApp.AndroidVersionName) );
Lookups.Add('$versionnumber$', IntToStr(Self.ZApp.AndroidVersionNumber) );
Code: Select all
function SanitizeFilename(const S: string): string;
const
InvalidChars: set of Char = ['\', '/', ':', '*', '?', '"', '<', '>', '|'];
var
C: Char;
begin
Result := '';
for C in S do
begin
if C in InvalidChars then
Result := Result + '_' // Replace with underscore
else
Result := Result + C;
end;
end;
Lookups.Add('$filename$', SanitizeFilename(String(Self.ZApp.Caption)));
And modify build.xml:
<project name="$filename$" default="help">
Finaly, maybe it could be used for the exe build?
Currently, the name of the exe is the name of the zgeproj file, not the (sanitized) caption name.
Or maybe we could simply use the zgeproj name for the $filename$ for android?
What do you think would be the best?