PowerShell / SHiPS

Simple Hierarchy in PowerShell - developing PowerShell provider got so much easier
MIT License
188 stars 33 forks source link

FileSystem Question #67

Closed crshnbrn66 closed 1 year ago

crshnbrn66 commented 7 years ago

In the example for filesystem the -root parameter when creating the drive specifies the name of the module filesystem#C this refers to the module name and implementing class correct? If that is true.. How do you do something like this:

new-psdrive test -PSProvider SHiPS -Root "filesystem#c:\temp" Do you add an overload to the constructors? C([string]$name): base($name),fileinfo($filename) { }

I tried that and got an error: new-psdrive test -psprovider Ships -root "filesystem#c#c:\temp" new-psdrive : Found invalid root format 'filesystem#c#c:\temp'. The supported format is 'Module#Class'.

Must you make a class for each thing you want to open?? Or is that the purpose of the dynamic example?

jianyunt commented 7 years ago

@crshnbrn66 Yes you are right. The format is 'Module#Class'. In this case, "C" is the class. If you want to support c:\temp, you need to define a class 'Temp'. In the GetChildItem() of the root Class C , you return 'Temp', similar to familytree sample.

crshnbrn66 commented 7 years ago

Is there any way to pass a Path to my provider then? .

jianyunt commented 7 years ago

Not supported by SHiPS.