[fpc-pascal] Directory Tree

Jean SUZINEAU jean.suzineau at wanadoo.fr
Sat Apr 24 15:38:52 CEST 2021


Le 23/04/2021 à 19:56, James Richters via fpc-pascal a écrit :
> RE: [fpc-pascal] Directory Tree
>
> Get Checked or Selected works great, but if I push it twice, the 
> second time I get:
>
> Unable to open file
>
> C:\Users\James\AppData\Local\Temp\FiC152.odt
>
> But I did make sure to close word and the PDF file before pushing it a 
> second time.
>
Yes, it's a very interesting bug that I'm currently investigating. May 
be I don't use the temp directory correctly.
When making the output, I start by copying the template file to another 
filename/filepath.
When I use my code to generate the new filename in the temp directory 
(Nom:= OD_Temporaire.Nouveau_ODT(Prefixe);),
on the second time, the system doesn't find the source file for the copy 
('FileVirtualTree_txt_to_odt.odt') and the copy fails.
But the source file isn't deleted, it continues to be visible in File 
Explorer, you can open it in LibreOffice.
And this happens either if , instead of using the CopyFile from 
lazutils/FileUtils.pas,  I use a home made "MyCopyFile" function coded 
with BlockRead/BlockWrite or even using command line cmd.exe / xcopy to 
do the job.

But if I copy the template to a file in the exe directory (just Nom:= 
'temp_'+IntToStr(temp)+'.odt'; Inc(temp);), it works ...

> I tried to change formatDateTime to include Days, because many 
> selections go well over 24 hours and it was just leaving the days 
> off... so instead of showing 2days, 3:14:54 it’s just showing 3:14:54
>
> So I changed format date to d:h:m:s but for some reason the totals of 
> the branches are coming up with 30 days even though the totals are 
> nowhere near even one day.I don’t see where the 30 days could possibly 
> be coming from.
>
I didn't had time to work on this for now. I think it's a bit too much 
complicated for FormatDateTime, it would be safer to decode the datetime 
value in a special function (something like days:= int(datetime); 
hours:= frac(datetime)*24; minutes:= frac(hours)*60 ... )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210424/ce762dc2/attachment-0001.htm>


More information about the fpc-pascal mailing list