uses SysUtils, CastleClassUtils;
procedure MakeSureMyStuffExistsInConfig;
var
OutputStream, InputStream: TStream;
begin
if not UriExists(ApplicationConfig('my_stuff.data')) then
begin
OutputStream := UrlSaveStream(ApplicationConfig('my_stuff.data'));
try
InputStream := Download('castle-data:/my_stuff_initial.data');
try
ReadGrowingStream(InputStream, OutputStream, true);
finally FreeAndNil(InputStream) end;
finally FreeAndNil(OutputStream) end;
end;
end;