IsGlobal() публичный Метод

public IsGlobal ( string path ) : bool
path string
Результат bool
Пример #1
0
 public void Remove(string source)
 {
     var package = getPackage(source);
     if (package == null) {
         _dispatch(string.Format("error|there is no package {0} to remove", source));
         return;
     }
     var profiles = new ProfileLocator(_token);
     var isGlobal = profiles.IsGlobal(package.File);
     removePackage(package, Path.GetDirectoryName(Path.GetDirectoryName(package.File)), isGlobal);
     _dispatch(string.Format("Removed package {0}", package.Signature));
 }
Пример #2
0
 public void Update(string packageToken)
 {
     var source = _packageFetcher.Fetch(packageToken);
     if (source == null) {
         _dispatch("error|cannot find the package you are trying to update to");
         return;
     }
     if (!File.Exists(source.Package)) {
         _dispatch("error|cannot find the package you are trying to update to");
         return;
     }
     Package packageToUpdate = null;
     prepareForAction(
         source.Package,
         (package) => {
             packageToUpdate = getPackages(true)
                 .FirstOrDefault(x => x.ID == package.ID);
             if (packageToUpdate == null) {
                 _dispatch("error|the package you are trying to update is not installed");
                 return null;
             }
             var profiles = new ProfileLocator(_token);
             _useGlobal = profiles.IsGlobal(packageToUpdate.File);
             return Path.GetDirectoryName(Path.GetDirectoryName(packageToUpdate.File));
         },
         (args) => {
                 if (args.Match == null)
                     printUnexistingUpdate(args.Package.ID, args.Package);
                 else
                     update(source.Package, packageToUpdate, args);
                 return true;
             });
     if (source.IsTemporaryPackage)
         File.Delete(source.Package);
 }
Пример #3
0
 private string getInstallPath(Package package, ProfileLocator profiles, string activeProfile)
 {
     string installPath;
     if (package.Target.StartsWith("language-")) {
         var path = getLanguageInstallPath(package, !_useGlobal);
         if (path == null) {
             _dispatch("error|could not find language to install language dependent package in");
             return null;
         }
         if (_useGlobal && !profiles.IsGlobal(path)) {
             _dispatch("error|cannot install language dependent package globally as language is installed locally.");
             return null;
         }
         return path;
     }
     if (_useGlobal)
         installPath = profiles.GetGlobalProfilePath(activeProfile);
     else
         installPath = profiles.GetLocalProfilePath(activeProfile);
     if (installPath == null) {
         _dispatch("error|the current location does not have an initialized config point");
         return null;
     }
     return Path.Combine(installPath, package.Target + "s");
 }