Question : Save files to a specified folder

Hi,

I have this for saving the data of several listviews to file.

procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  SaveListViewToFile(lstvGlucose, 'Glucose.sav');
  SaveListViewToFile(lstvBolus, 'Bolus.sav');
  SaveListViewToFile(lstvFoodDB, 'FoodDB.sav');
  SaveListViewToFile(lstvOwnDB, 'OwnDB.sav');
end;
(*---------------------------------------------------*)
procedure TMainForm.FormCreate(Sender: TObject);
begin
  if FileExists('Glucose.sav') then LoadListViewToFile(lstvGlucose, 'Glucose.sav');
  if FileExists('Bolus.sav') then LoadListViewToFile(lstvBolus, 'Bolus.sav');
  if FileExists('FoodDB.sav') then LoadListViewToFile(lstvFoodDB, 'FoodDB.sav');
  if FileExists('OwnDB.sav') then LoadListViewToFile(lstvOwnDB, 'OwnDB.sav');
end;
(*---------------------------------------------------*)

These files (if not exists) will be created and save to the application-folder.
But now I have made a folder called Data in the application-folder and I
want the programm to save (or create the files) in the folder.
I quess I have to change the code. Can someone help me?

P.

Answer : Save files to a specified folder

Just change the paths to include Data\, i.e


procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  SaveListViewToFile(lstvGlucose, 'Data\Glucose.sav');
  SaveListViewToFile(lstvBolus, 'Data\Bolus.sav');
  SaveListViewToFile(lstvFoodDB, 'Data\FoodDB.sav');
  SaveListViewToFile(lstvOwnDB, 'Data\OwnDB.sav');
end;
(*---------------------------------------------------*)
procedure TMainForm.FormCreate(Sender: TObject);
begin
  if FileExists('Data\Glucose.sav') then LoadListViewToFile(lstvGlucose, 'Data\Glucose.sav');
  if FileExists('Data\Bolus.sav') then LoadListViewToFile(lstvBolus, 'Data\Bolus.sav');
  if FileExists('Data\FoodDB.sav') then LoadListViewToFile(lstvFoodDB, 'Data\FoodDB.sav');
  if FileExists('Data\OwnDB.sav') then LoadListViewToFile(lstvOwnDB, 'Data\OwnDB.sav');
end;
(*---------------------------------------------------*)
Random Solutions  
 
programming4us programming4us