From f6a0d844b3e8570e9f3ee771544e288f0e0945ff Mon Sep 17 00:00:00 2001 From: Sun Serega Date: Fri, 27 Sep 2024 12:30:25 +0200 Subject: [PATCH] Auto-create directories for logs --- AOtp.pas | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AOtp.pas b/AOtp.pas index a2ce1803..03c5cbd9 100644 --- a/AOtp.pas +++ b/AOtp.pas @@ -294,6 +294,8 @@ OtpLine = class public constructor(fname: string; timed: boolean := false; req_kinds: OtpKind? := nil; bad_kinds: OtpKind? := nil); begin + fname := System.IO.Path.GetFullPath(fname); + System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(fname)); self.bu_fname := fname+'.backup'; self.main_sw := new System.IO.StreamWriter(fname, false, enc); self.backup_sw := new System.IO.StreamWriter(bu_fname, false, enc);