Exemple #1
0
        void SetPathTypes(string path, SessionState sessionState)
        {
            ProviderInfo pinfo;
            // use the globber to parse the path and set the different types
            var runtime = new ProviderRuntime(sessionState);
            runtime.PSDriveInfo = Drive;
            var globber = new PathGlobber(sessionState);
            _path = globber.GetProviderSpecificPath(path, runtime, out pinfo);
            // update the Provider and Drive in case it changed
            Provider = pinfo;
            Drive = runtime.PSDriveInfo;

            _providerQualified = globber.GetProviderQualifiedPath(_path, Provider);
            Path = _providerQualified;

            if (Drive != null && !String.IsNullOrEmpty(Drive.Name))
            {
                _driveQualified = globber.GetDriveQualifiedPath(_path, Drive);
                Path = _driveQualified;
            }
        }
Exemple #2
0
 internal string Combine(string parent, string child, ProviderRuntime runtime)
 {
     ProviderInfo providerInfo;
     parent = new PathGlobber(_sessionState).GetProviderSpecificPath(parent, runtime, out providerInfo);
     var provider = _sessionStateGlobal.Provider.GetInstance(providerInfo);
     return Combine(provider, parent, child, runtime);
 }
Exemple #3
0
 // internals
 internal bool IsValid(string path, ProviderRuntime runtime)
 {
     ProviderInfo providerInfo;
     path = new PathGlobber(_sessionState).GetProviderSpecificPath(path, runtime, out providerInfo);
     var provider = _sessionStateGlobal.Provider.GetInstance(providerInfo);
     var itemProvider = CmdletProvider.As<ItemCmdletProvider>(provider);
     return itemProvider.IsValidPath(path, runtime);
 }