View Issue Details

IDProjectCategoryView StatusLast Update
0027591LazarusLCLpublic2015-03-04 21:05
ReporteroceanAssigned ToBart Broersma 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
PlatformWindowsOSOS Version
Product Version1.5 (SVN)Product Build 
Target Version1.4Fixed in Version1.4 
Summary0027591: ShellTreeView error message on startup
DescriptionDrop component to form and run. See attachment

(There is nothing wrong with that path)

Lazarus + FPC svn from today
TagsNo tags attached.
Fixed in Revisionr48121, r48125, r48135
LazTarget-
WidgetsetWin32/Win64
Attached Files
  • invalidpath.jpg (27,788 bytes)
    invalidpath.jpg (27,788 bytes)
  • shellctrls.pas.patch (927 bytes)
    Index: lcl/shellctrls.pas
    ===================================================================
    --- lcl/shellctrls.pas	(revision 48105)
    +++ lcl/shellctrls.pas	(working copy)
    @@ -1011,13 +1011,13 @@
                 else
                   Fn := Fn + PathDelim + Dirs.Strings[i];
                 {$if defined(windows) and not defined(wince)}
    -            if (Length(Fn) = 2) and (Fn[2] = ':') then Continue;
    +            if ((Length(Fn) = 2) or (Length(Fn) = 3)) and (Fn[2] = ':') then Continue;
                 {$endif}
                 Attr := FileGetAttrUtf8(Fn);
                 if (Attr <> -1) and ((Attr and faHidden) > 0) then
                 begin
                   Result := False;
    -              //writeln('TCustomShellTreeView.SetPath.Exists: a subdir is hiddden: Result := False');
    +              //writeln('TCustomShellTreeView.SetPath.Exists: a subdir is hidden: Result := False');
                   Break;
                 end;
               end;
    
    shellctrls.pas.patch (927 bytes)
  • bug27591.zip (128,568 bytes)

Activities

ocean

2015-03-02 19:38

reporter  

invalidpath.jpg (27,788 bytes)
invalidpath.jpg (27,788 bytes)

ocean

2015-03-02 22:44

reporter  

shellctrls.pas.patch (927 bytes)
Index: lcl/shellctrls.pas
===================================================================
--- lcl/shellctrls.pas	(revision 48105)
+++ lcl/shellctrls.pas	(working copy)
@@ -1011,13 +1011,13 @@
             else
               Fn := Fn + PathDelim + Dirs.Strings[i];
             {$if defined(windows) and not defined(wince)}
-            if (Length(Fn) = 2) and (Fn[2] = ':') then Continue;
+            if ((Length(Fn) = 2) or (Length(Fn) = 3)) and (Fn[2] = ':') then Continue;
             {$endif}
             Attr := FileGetAttrUtf8(Fn);
             if (Attr <> -1) and ((Attr and faHidden) > 0) then
             begin
               Result := False;
-              //writeln('TCustomShellTreeView.SetPath.Exists: a subdir is hiddden: Result := False');
+              //writeln('TCustomShellTreeView.SetPath.Exists: a subdir is hidden: Result := False');
               Break;
             end;
           end;
shellctrls.pas.patch (927 bytes)

ocean

2015-03-02 22:46

reporter   ~0081575

1.4rc2 also have this
patch avoids the fault

ocean

2015-03-03 10:38

reporter   ~0081589

Forget patch, it only worked in case project was saved to C:\somefolder
FileGetAttrUtf8('C:\'); returns hidden in Windows. Appdata is also hidden.

Bart Broersma

2015-03-03 15:51

developer   ~0081598

If the path contains a hidden folder and otHidden is NOT in ObjectTypes then the error is expected (and designed to behave like this).

ocean

2015-03-03 16:41

reporter   ~0081600

Like said, exception happens also C:\somefolder

FileGetAttrUtf8('C:\'); returns hidden attribute (surprising)

Bart Broersma

2015-03-03 16:54

developer   ~0081602

Please attach sample project.
I have no issues with TShellTreeView on my PC, so it must be specific to some (property) setting?

At least I can think of one possible source of error: if Root contains a hidden folder (c:\foo\.svn\bar) then the check in SetPath might be wrong.

As a workaround: try including otHidden in ObjectTypes.

ocean

2015-03-03 17:20

reporter  

bug27591.zip (128,568 bytes)

ocean

2015-03-03 17:20

reporter   ~0081604

Extract zip to C:\ and compile & run.

Invalid pathname:
"C:\somefolder\"

Happens both WinXP and Win7.

otHidden = true or false, doesn't make any difference

Anton

2015-03-03 20:15

reporter   ~0081610

I think OS related.
In my Win7HE it also thinks that "D:\" is hidden (I have TEMP in D:\Temp).

Bart Broersma

2015-03-03 21:06

developer   ~0081615

Please test and close if OK.

Note (0081602) seemed to be the root cause of the problem.
(In your case Root was seen as a hidden folder)

There also was an error in TryCreateRelativePath function in LazFileUtils.

B.t.w. FilegetAttrUTF8 on C:\ also gives me faHidden, but on a substituted drive like X:\ it does not (win7).

ocean

2015-03-04 07:49

reporter   ~0081620

Sample still fails same way

Invalid relative pathname:
"C:\somefolder\"
in relation to rootpath:
""

Bart Broersma

2015-03-04 11:33

developer   ~0081623

Added check for drive roots.
The errormessage was also wrong.
Please test and close if I got it right this time.

ocean

2015-03-04 14:23

reporter   ~0081625

Sample works now.

But before close, have one question.

Why should it matter where project is saved? Unsaved project in Win7 still gives error, because it's in (hidden) temp folder.

There is a line in constructor:

ObjectTypes:= [otFolders];

This calls SetPath without "otHidden", even if you have "otHidden=true" set

Bart Broersma

2015-03-04 14:38

developer   ~0081627

I cannot reproduce that.
Empty project, shelltreeview, shelllistview.
Root = ''
ObjectTypes = [otFolders]
Don't save. Run inside IDE. No error

My test suit:
- ShellTreeView connected to ShellListView
- Root = ''
- ObjectTypes = [otFolders]
- Build
Move executable to folder with attribute faHidden.
Run: no error.

ocean

2015-03-04 16:06

reporter   ~0081631

>Move executable to folder with attribute faHidden.
>Run: no error.

Okay, error only shows under IDE (there is try&except)

Bart Broersma

2015-03-04 16:17

developer   ~0081633

On which line (in which method)?
(SetPath should not be called when component isn't load fully)

ocean

2015-03-04 16:23

reporter   ~0081635

TCustomShellTreeView.SetObjectTypes there is line SetPath(CurrPath); (And that is called from constructor)

Bart Broersma

2015-03-04 17:09

developer   ~0081638

Should be fixed now.

ocean

2015-03-04 21:05

reporter   ~0081644

Yes, works now

Issue History

Date Modified Username Field Change
2015-03-02 19:38 ocean New Issue
2015-03-02 19:38 ocean File Added: invalidpath.jpg
2015-03-02 22:44 ocean File Added: shellctrls.pas.patch
2015-03-02 22:46 ocean Note Added: 0081575
2015-03-03 10:38 ocean Note Added: 0081589
2015-03-03 15:51 Bart Broersma LazTarget => -
2015-03-03 15:51 Bart Broersma Note Added: 0081598
2015-03-03 15:51 Bart Broersma Assigned To => Bart Broersma
2015-03-03 15:51 Bart Broersma Status new => feedback
2015-03-03 16:41 ocean Note Added: 0081600
2015-03-03 16:41 ocean Status feedback => assigned
2015-03-03 16:54 Bart Broersma Note Added: 0081602
2015-03-03 16:54 Bart Broersma Status assigned => feedback
2015-03-03 17:20 ocean File Added: bug27591.zip
2015-03-03 17:20 ocean Note Added: 0081604
2015-03-03 17:20 ocean Status feedback => assigned
2015-03-03 20:15 Anton Note Added: 0081610
2015-03-03 21:06 Bart Broersma Fixed in Revision => r48121
2015-03-03 21:06 Bart Broersma Note Added: 0081615
2015-03-03 21:06 Bart Broersma Status assigned => resolved
2015-03-03 21:06 Bart Broersma Fixed in Version => 1.4
2015-03-03 21:06 Bart Broersma Resolution open => fixed
2015-03-03 21:06 Bart Broersma Target Version => 1.4
2015-03-04 07:49 ocean Note Added: 0081620
2015-03-04 07:49 ocean Status resolved => assigned
2015-03-04 07:49 ocean Resolution fixed => reopened
2015-03-04 11:33 Bart Broersma Fixed in Revision r48121 => r48121, r48125
2015-03-04 11:33 Bart Broersma Note Added: 0081623
2015-03-04 11:33 Bart Broersma Status assigned => resolved
2015-03-04 11:33 Bart Broersma Resolution reopened => fixed
2015-03-04 14:23 ocean Note Added: 0081625
2015-03-04 14:38 Bart Broersma Note Added: 0081627
2015-03-04 14:38 Bart Broersma Status resolved => feedback
2015-03-04 16:06 ocean Note Added: 0081631
2015-03-04 16:06 ocean Status feedback => assigned
2015-03-04 16:17 Bart Broersma Note Added: 0081633
2015-03-04 16:17 Bart Broersma Status assigned => feedback
2015-03-04 16:23 ocean Note Added: 0081635
2015-03-04 16:23 ocean Status feedback => assigned
2015-03-04 17:09 Bart Broersma Fixed in Revision r48121, r48125 => r48121, r48125, r48135
2015-03-04 17:09 Bart Broersma Note Added: 0081638
2015-03-04 17:09 Bart Broersma Status assigned => resolved
2015-03-04 21:05 ocean Note Added: 0081644
2015-03-04 21:05 ocean Status resolved => closed