Este es el codigo que utilizo para crear el alias cuando en la maquina no existe.
Siempre la base de datos va a estar en el directorio donde se ejecute la aplicación, pero este en algunos equipos se va por la red a buscar algo..
DB_DIRNAME = datos
GE_DBNAMEALIAS = ‘Gelec’
session.NetFileDir := 'c:\';
(* If alias does not exist then create it *)
if not Session.IsAlias(GE_DBNAMEALIAS) then begin
(* Create alias *)
sDBPath := ExtractFilePath(Application.Exename) + DB_DIRNAME;
Session.AddStandardAlias(GE_DBNAMEALIAS, sDBPath, 'PARADOX');
try
Session.SaveConfigFile;
except
ShowMessageBox(Application.Handle , GetMsg(IDS_GEEXEC0002),
GetMsg(IDS_MSG_ERROR),
MB_ICONINFORMATION or MB_OK);
UnloadLang;
Halt(0);
end;
end
else begin (* Update alias directory *)
lstParams := TStringList.Create;
lstParams.Clear;
sDBPath := ExtractFilePath(Application.Exename) + DB_DIRNAME;
lstParams.Add('PATH=' + sDBPath);
Session.ModifyAlias(GE_DBNAMEALIAS, lstParams);
try
Session.SaveConfigFile;
except
ShowMessageBox(Application.Handle , GetMsg(IDS_GEEXEC0002),
GetMsg(IDS_MSG_ERROR),
MB_ICONINFORMATION or MB_OK);
UnloadLang;
Halt(0);
end;
lstParams.Destroy;
end;