Re: Comparing FolderItems

roland <[email protected]> Fri, 18 May 2018 10:58:02 +0200
Newsgroups gmane.comp.lang.realbasic.user
Message-ID <[email protected]>
This works. If you copy paste the name of the item you looking for, from 
win explorer into "nota.txt", you will know if there are strange 
characters in it.

Dim desktopFolder As FolderItem = SpecialFolder.Desktop
If desktopFolder Is Nil Then
   Return
End If

Dim count As Integer  = desktopFolder.Count
For i As Integer = 1 To count
   Dim f As FolderItem = desktopFolder.Item(i)

   If f <> Nil Then
     if f.Name = "nota.txt" then
       ListBox1.AddRow(f.Name)
     end if
   End If
Next

Roland Brouwers
C.A.T.
Zevenbergenlaan 16
2660 Antwerpen(hoboken)
Mob: +32 475 443 105

Op 18/05/2018 om 10:36 schreef Francois Van Lerberghe:
> It could be an issue related to decomposed/composed non-ASCII chars. What's the file name ? Has it non-ASCII chars ?
>
> For compare folder name, I use
> 	MyFolder1.Name.ConvertEncoding(encodings.SystemDefault)
>
> François Van Lerberghe
> Thier Monty, 15 A
> 4570 Marchin (Belgium)
> +32 (0) 85 25 08 25
>
>> Le 18 mai 2018 à 10:24, Jean-Luc Arnaud <jean-luc-E/[email protected]> a écrit :
>>
>> Hi all,
>>
>> I'm issuing something strange (at least for me).
>>
>> I'm probably wrong in my code but don't understand why.
>>
>> I'm trying to compare 2 FolderItems as follow:
>>
>>          If MyFolder1=MyFolder2.Child(MyFolder1_Name) Then
>>              // It's the folderitem I'm looking for
>>          EndIf
>>
>> where MyFolder1_Name is a string representing MyFolder1.Name, and of course, MyFolder1 exists and is located in MyFolder2.
>>
>> This results always as False, even if the folderitems are the same (verified comparing their NativePath).
>> So, it seems like I should compare NativePaths instead of FolderItems themselves. But I would like to understand...
>>
>> TIA for any information.
>>
>> -- 
>> Jean-Luc Arnaud
>>