Folder contents loading and OS service files

Each OS (AFAIK) have service files (.DS_Store, Thumbsdb, etc.)

In my test project (the one I use with 2018r1), I drop a folder on the main window and the application process itscontents.

I use .TrueItem to scan that folder contents nd found a personal problem I have troubles to solve.

The example below is an adaptation of an Example from FolderItem.Item, but displays my problem.

BTW: skip the “it does not works” if this is the case: it only displays how I load the files from that folder (by 6 images).

The problem ? In that folder (and even if I do not open it), on MacOS, I have a Service file (.DS_Store) that is loaded instead of an image. In y test folder, it is .TrueItem(1); but this is not important. *

The actual result of my code is a missing image in page 1, then an error in all subsequent pages, just because of the presence of a file I do not want.

I have been on the bridge since this morning on this subject and I have not found a solution. Does somebody have an idea ?

[code]Dim itemIdx, dirCount, ImgIdx As Integer
Dim dir, item As FolderItem

dir = SpecialFolder.Desktop
dirCount = dir.Count
For itemIdx = 1 To dirCount step 6
For ImgIdx = 1 to 6 // Load all 6 images here
item = dir.TrueItem(itemIdx + ImgIdx)
If item <> Nil Then
Me.AddRow “[” + Str(ImgIdx) + “]” + item.DisplayName // Imagine this line load and print the lmage file
Me.AddRow “” // Simulate a form feed
End If
Next

Next[/code]

I print in the generated pdf the first image in the front page, that is why I know this service file position in the folder… This trouble I resolved by my own.
If .TrueItem(1) name is ".DS_Store’, then load .TrueItem(2), basically, hoppin only one service file there / .TrueItem(2) is my first image file.

Edit: modified the code because it have too many errors… :frowning:

under macOS any file that begins with a “.” is a “HIDDEN” file, (same with Windows?)
unless you have a specific reason, these files should be “skipped” in any processing you do

.DSStore is in fact the disk drives “DIRECTORY” with icon info etc… which is why it is hidden and should not be messed with

https://en.wikipedia.org/wiki/.DS_Store

Thank you Dave for the explanation.

About custom Icons: they have a specific invisible file (that ends with a CR (as strange as it seems). The Custom Icon information stored in .DS_Store is its existence or absence, not the Icon by itself.

Back to my problem (above): after a nice (and unvoluntary) nap, a close look at my code reveal where the trouble lie: I used a -1 (in the FolderItem.Count line) for whatever reason, and that was the cause. The actual code can brreak in the future, but starting to look at .TrueItem(2) resolve my problem.

The shared code is nice (as is, but not for my use), display the base design of my code.

Question resolved.