View Issue Details

IDProjectCategoryView StatusLast Update
0015908LazarusLCLpublic2010-03-17 00:41
ReporterElphi Assigned ToFelipe Monteiro de Carvalho  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.28.3 (SVN) 
Target Version0.9.30Fixed in Version0.9.29 (SVN) 
Summary0015908: TShellTreeView .GetPathPathFromNode returns invalid path
DescriptionWhen selecting for example the windows directory Program Files on drive C the following path is returned:

C:\\Program Files.

Additional Informationfunction TCustomShellTreeView.GetPathFromNode(ANode: TTreeNode): string;
var
  rootDir : String;
begin
  // If nothing is selected, then the base is selected
  if ANode = nil then Exit(GetBasePath());

  // In the future use ANode.Data instead of ANode.Text
  rootDir := PChar(ANode.Text);
  while (ANode.Parent <> nil)do
  begin
    ANode := ANode.Parent;
    if (PChar(ANode.Text) <> PathDelim) then <---- Last character should be tested
      rootDir := PChar(ANode.Text) + PathDelim + rootDir
    else
      rootDir := PChar(ANode.Text) + rootDir;
  end;
  // Check, maybe the base path won't be necessary in the future
  // if the base directory is added to the items list
  Result := GetBasePath + rootDir;
end;
TagsNo tags attached.
Fixed in Revision23983
LazTarget0.9.30
WidgetsetWin32/Win64
Attached Files

Activities

2010-03-07 17:24

 

shellctrls.zip (814 bytes)

Dmitry Boyarintsev

2010-03-07 17:25

developer   ~0035016

the bug describe above is fixed, by the following changes (include in the patch):

 class function TCustomShellTreeView.GetBasePath: string;
@@ -451,7 +468,7 @@
   begin
 // r := GetDriveType(pDrive);
 
- NewNode := Items.AddChildObject(nil, pDrive, pDrive);
+ NewNode := Items.AddChildObject(nil, ExcludeTrailingBackslash(pDrive), nil);
     NewNode.HasChildren := True;
 
     Inc(pDrive, 4);


But i also couldn't resist the temptation of adding a fix to another Windows related problem, included in the patch, see the comments.

Felipe Monteiro de Carvalho

2010-03-09 23:29

developer   ~0035118

Last edited: 2010-03-10 02:25

Sure, the patch looks fine. Do you have commit access to the necessary folders? If yes, please apply it yourself.

Felipe Monteiro de Carvalho

2010-03-14 01:40

developer   ~0035468

Thanks, applied, please test and close if ok

Issue History

Date Modified Username Field Change
2010-03-07 12:46 Elphi New Issue
2010-03-07 12:46 Elphi Widgetset => Win32/Win64
2010-03-07 17:24 Dmitry Boyarintsev File Added: shellctrls.zip
2010-03-07 17:25 Dmitry Boyarintsev Note Added: 0035016
2010-03-07 19:46 Vincent Snijders LazTarget => 0.9.30
2010-03-07 19:46 Vincent Snijders Assigned To => Felipe Monteiro de Carvalho
2010-03-07 19:46 Vincent Snijders Status new => assigned
2010-03-07 19:46 Vincent Snijders Target Version => 0.9.30
2010-03-09 23:29 Felipe Monteiro de Carvalho Note Added: 0035118
2010-03-09 23:30 Felipe Monteiro de Carvalho Status assigned => feedback
2010-03-10 02:25 Felipe Monteiro de Carvalho Note Edited: 0035118
2010-03-14 01:40 Felipe Monteiro de Carvalho Fixed in Revision => 23983
2010-03-14 01:40 Felipe Monteiro de Carvalho Status feedback => resolved
2010-03-14 01:40 Felipe Monteiro de Carvalho Fixed in Version => 0.9.29 (SVN)
2010-03-14 01:40 Felipe Monteiro de Carvalho Resolution open => fixed
2010-03-14 01:40 Felipe Monteiro de Carvalho Note Added: 0035468
2010-03-17 00:41 Elphi Status resolved => closed