tags:

views:

58

answers:

3

I know you can write support for custom PSDrives. But those are always a root of a file system. What would be nice if there was a way to allow for VFS start at arbitrary nodes of the file system, such as using Set-Location to enter archive file maybe and use them as if they were folders. (Kinda like Far does this).

Is there any way to achieve this? I know, it would be some work to get it right and working, but at the moment I am more interested whether it would be possible at all.

ETA: What I don't want is a new PSDrive for every archive I enter, so the following isn't actually what I'm after:

PS C:\Path> Invoke-Magic stuff.zip
PS C:\Path> Set-Location MyNewDrive:
PS MyNewDrive:> _

but rather

PS C:\Path> Set-Location stuff.zip
PS C:\Path\stuff.zip> _
A: 

Sure. In fact, you can already do this to some degree without writing any snap-in code. For example:

New-PsDrive -Scope Global -Name MyMod -PSProvider FileSystem -Root (split-path $profile | join-path -child Modules)
dir MyMod:\
Richard Berg
The point is, I specifically *don't* want a new PSDrive but rather extending semantics for existing file systems. I'll update the question.
Joey
Looks kinda like `subst` to me what you're doing there, though.
Joey
Ah, I misunderstood what you were asking for.
Richard Berg
A: 

You need to write a provider, here is an example for a provider for SourceSafe (old but still relevant)

Shay Erlichmen
+1  A: 

What you're describing is a FileSystem provider that also considers archives to be container objects. As FileSystemProvider is sealed, I think you would have to write your own NavigationCmdletProvider that does your magic.

dahlbyk