devblackops / Terminal-Icons

A PowerShell module to show file and folder icons in the terminal
MIT License
2.52k stars 110 forks source link

[bug/show-terminaliconstheme] Command displays default file icon on folders #122

Open DoctorSclero opened 11 months ago

DoctorSclero commented 11 months ago

Expected Behavior

Executing the command should display the themed folder icons.

Current Behavior

Executing the command renders correctly the file icons but treats folders as files, displaying the default file icon.

image

The issue is not experienced in normal use:

image

Possible Solution

I think the problem could be in Resolve-Icon.ps1, following step by step the code execution running the commands by hand in the terminal, I couldn't find the PSIsContainer attribute on $FileInfo, maybe it skips to the type of file because of that. I still have to figure out why it does not occur in normal use.

My poor attempt to figure out the problem 😅:

image image

As you can see nothing is returned, and it didn't autocomplete. (The smaller image is the expected custom one) The piece of code I think is responsible for the bug:

if ($FileInfo.PSIsContainer) { <----- PSIsContainer not present
    $type = 'Directories'
} else {
    $type = 'Files'
}

Steps to Reproduce (for bugs)

  1. Import-Module Terminal-Icons
  2. Show-TerminalIconsTheme

Context

I'm using the command to debug the icon theme I'm creating.

Your Environment