Stephanevg/PSHTML

includes folder is set up to high in the foler path

Opened this issue · 1 comments

It looks like the the project includes folder's path is wrongly calculated, and is one level too high in the folder path.
This means that the current project includes path is wrongly calculated, and doesn't work as expected / originally designed.

Example:

The file 'events.ps1' contains the following code

ipmo pshtml -force

$content = html{
    Get-PSHTMLInclude
    Write-PSHTMLInclude
}

The following structure

image

It looks like that the events.ps1 script when it is beeing called, that the module will create thepath to the project include folder at the level of hatchingPS (in yellow).

It actually should create the project includes path at a one level above the events.ps1 file. (In green).

It looks like that besides the fact that the project includes folder is calculated too high in the hierarchy, either a variable is wrongly named, or there is a bug, where 'assets' it set instead of 'includes'

https://github.com/Stephanevg/PSHTML/blob/master/PSHTML/PSHTML.psm1#L72

image

I found out what the source of the issue is:

The variable used to calculate the source of where the includes folder is, is the $sessionstate.
This variable will do all it's logic based on from where the currentlocation the script is called, not where the script is actually located.

See example:

image