![]() |
Re: Verzeichnis auf Existenz prüfen?
Trotzdem habe ich Deinen Code mal neu formatiert:
Delphi-Quellcode:
Bei nachvollziehbarer Einrückung sieht man das sofort :zwinker:
procedure TForm1.FormShow(Sender: TObject);
var update: Integer; Ini : TIniFile; UserAppDataDir, ProgPath: String; begin UserAppDataDir := GetSpecialFolder(CSIDL_LOCAL_APPDATA); if FileExists(UserAppDataDir + AppDataRootDir + AppDataProjectDir + '\Config.ini') then //dieser Block wird niemals ausgeführt, wenn die Ini nicht existiert begin Ini := TIniFile.Create(UserAppDataDir + AppDataRootDir + AppDataProjectDir + '\Config.ini'); try ComboBox1.ItemIndex := Ini.ReadInteger('Default', 'Channel', 1); finally ini.free; end; if DirectoryExists(UserAppDataDir + AppDataRootDir + AppDataProjectDir) then begin showmessage('Ja'); end else showmessage('Nein'); ProgPath := ExtractFilePath(ParamStr(0)); if FileExists(UserAppDataDir + AppDataRootDir + AppDataProjectDir + '\original.txt') then begin ListBox1.Items.LoadFromFile(UserAppDataDir + AppDataRootDir + AppDataProjectDir + '\original.txt'); end else ListBox1.Items.LoadFromFile(ProgPath + 'ersatz.txt'); end; end; |
Re: Verzeichnis auf Existenz prüfen?
Hab das Programm noch mal gestartet, ohne Code zu ändern, und es wird auf einmal nix erstellt, nicht die ini und nicht der Ordner, jetzt verstehe ich garnix. :wall:
Aber danke dir, ich gucke mal jetzt weiter. |
Re: Verzeichnis auf Existenz prüfen?
Hab die Geschichte mit der .ini am Ende der procedure gesetzt und jetzt funkt alles, aber wirklich alles. :dancer2:
Thx noch mal. :thumb: |
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:27 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz