View Issue Details

IDProjectCategoryView StatusLast Update
0029695LazarusLazUtilspublic2016-03-19 07:37
Reportersamuel herzogAssigned ToBart Broersma 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformwindowsOSwindows 7OS Version
Product Version1.6Product Build 
Target Version1.7 (SVN)Fixed in Version1.7 (SVN) 
Summary0029695: Function "CopyDirTree" is not working anymore in 1.6
DescriptionThe function "CopyDirTree" works fine in Lazarus 1.4.4 fpc 2.6.4
but does not work anymore in Lazarus 1.6 fpc 3.0.0

Steps To Reproduce1. unzip the attached example project.
2. run project and press button.
3. the content of folder "source" should be copied to folder "target".
Additional Informationprocedure TForm1.Button1Click(Sender: TObject);
var
  _sourcepath:string;
  _targetpath:string;
begin
  _sourcepath:=ExtractFilePath(application.exename)+'source\';
  _targetpath:=ExtractFilePath(application.exename)+'target\';

  if not CopyDirTree(_sourcepath,_targetpath,[cffOverwriteFile,cffCreateDestDirectory,cffPreserveTime]) then begin
    ShowMessagefmt('Could not copy the folder <%s> to <%s>.',[_sourcepath,_targetpath]);
    exit;
  end;
end;
TagsNo tags attached.
Fixed in Revisionr51675
LazTarget1.6
WidgetsetWin32/Win64
Attached Files

Relationships

has duplicate 0030628 closedBart Broersma CopyDirTree bug 
has duplicate 0031015 closedBart Broersma CopyDirTree do not work on linux 

Activities

samuel herzog

2016-02-21 20:16

developer  

copydirtree.7z (60,791 bytes)

wp

2016-02-21 21:19

developer   ~0090180

I can confirm. Looking through the recent svn revisions of "fileutil.inc" I found that the bug was introduced in r51038; r51037 is still working.

Bart Broersma

2016-02-22 19:14

developer   ~0090195

Reverted the wrong revision.

samuel herzog

2016-03-01 07:01

developer   ~0090503

Tested today with trunk version and is ok now. Thank you.

samuel herzog

2016-03-16 21:35

developer   ~0091135

This again not working anymore. Please test with my attached example.

The code tries to prevent that the target-folder can not be within the source-folder. On windows this not seem to work.

With the latest version of fileutil.inc r51834 the following code

if Utf8StartsText(Searcher.FSourceDir, Searcher.FTargetDir) then Exit;

is used. But I can not find the method "Utf8StartsText".

Bart Broersma

2016-03-16 22:03

developer   ~0091137

It still works for me:
Src = "C:\Users\Bart\LazarusProjecten\bugs\FileUtf8\source\"
Dest = "C:\Users\Bart\LazarusProjecten\bugs\FileUtf8\target\"
CopyDirTree = OK
(r51965 pfc 3.0.0 32-bit, Win7-64)

What exactly does not work for you?
Does it not compile, or does the CopyDirTree retuns False?
NB: Utf8StartsText is in LazUtf8 (hoovering the mouse over it, or Ctrl+Click should reveal that.

samuel herzog

2016-03-16 22:39

developer   ~0091139

I can not compile at the moment. I search the whole lazarus folder for all files with extension .pp;.pas;.inc that contain the word "Utf8StartsText". The only file showed is "fileutil.inc".

Bart Broersma

2016-03-16 22:53

developer   ~0091140

It's in ($Lazarus)/components/lautils/lazutf8.pas at line 123 (definition, implementation is at line 2817 (introduced in r51692, in trunk!).
I guess your LazUtf8.pas isn't up to date, or you have local modifications.
In lazarus folder do:
svn -q status
This will tell you if you have any modified files.
If so, revert them (svn revert -R path/to/folder)
Then in lazarus folder do
make clean
svn up

samuel herzog

2016-03-19 07:37

developer   ~0091191

Yes, you are right. Everything ok. Was my fault. Thank you.

Issue History

Date Modified Username Field Change
2016-02-21 20:15 samuel herzog New Issue
2016-02-21 20:16 samuel herzog File Added: copydirtree.7z
2016-02-21 20:17 samuel herzog Additional Information Updated View Revisions
2016-02-21 21:19 wp Note Added: 0090180
2016-02-21 21:34 Juha Manninen Assigned To => Bart Broersma
2016-02-21 21:34 Juha Manninen Status new => assigned
2016-02-22 19:14 Bart Broersma Fixed in Revision => r51675
2016-02-22 19:14 Bart Broersma LazTarget - => 1.6
2016-02-22 19:14 Bart Broersma Note Added: 0090195
2016-02-22 19:14 Bart Broersma Status assigned => resolved
2016-02-22 19:14 Bart Broersma Fixed in Version => 1.6
2016-02-22 19:14 Bart Broersma Resolution open => fixed
2016-03-01 07:01 samuel herzog Note Added: 0090503
2016-03-01 07:01 samuel herzog Status resolved => closed
2016-03-01 07:01 samuel herzog Fixed in Version 1.6 => 1.7 (SVN)
2016-03-16 21:35 samuel herzog Note Added: 0091135
2016-03-16 21:35 samuel herzog Status closed => assigned
2016-03-16 21:35 samuel herzog Resolution fixed => reopened
2016-03-16 22:03 Bart Broersma Note Added: 0091137
2016-03-16 22:03 Bart Broersma Status assigned => feedback
2016-03-16 22:39 samuel herzog Note Added: 0091139
2016-03-16 22:39 samuel herzog Status feedback => assigned
2016-03-16 22:53 Bart Broersma Note Added: 0091140
2016-03-16 22:53 Bart Broersma Status assigned => feedback
2016-03-18 11:16 Bart Broersma Status feedback => resolved
2016-03-18 11:16 Bart Broersma Resolution reopened => fixed
2016-03-19 07:37 samuel herzog Note Added: 0091191
2016-03-19 07:37 samuel herzog Status resolved => closed
2016-09-22 21:24 Bart Broersma Relationship added has duplicate 0030628
2016-11-26 19:40 Bart Broersma Relationship added has duplicate 0031015