I have the app showing its designated background image while app loads. It then crashes running this code at startup:
// unzip own resources like images, data files ettc.
FAppDataDirPath := GetHomePath + PathDelim + Application.Title + '.app' + PathDelim;
P := FAppDataDirPath + 'assets.zip';
if FileExists(P) then
begin
Z := TZipFile.Create;
try
Z.Open(P, zmRead);
Z.ExtractAll(FAppDataDirPath + 'Library');
finally
Z.Free;
end;
end
;
This is the error I get:
The problem is that you're using the wrong method to get the locations.
Switch to using System.IOUtils.TPath
, using TPath.GetHomePath
to get the home folder, TPath.GetDocumentsPath
for the Documents
folder, and TPath.GetLibraryPath
to get the Library
folder location.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.