~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/Misc/PackageManagement/Project/Src/Scripting/PackageInitializeScript.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using NuGet;
 
6
 
 
7
namespace ICSharpCode.PackageManagement.Scripting
 
8
{
 
9
        public class PackageInitializeScript : PackageScript
 
10
        {
 
11
                public PackageInitializeScript(IPackage package, IPackageScriptFileName fileName)
 
12
                        : base(package, fileName)
 
13
                {
 
14
                }
 
15
                
 
16
                protected override void BeforeRun()
 
17
                {
 
18
                        AddScriptDirectoryToEnvironmentPath();
 
19
                }
 
20
                
 
21
                void AddScriptDirectoryToEnvironmentPath()
 
22
                {
 
23
                        if (ScriptFileName.ScriptDirectoryExists()) {
 
24
                                string directory = ScriptFileName.GetScriptDirectory();
 
25
                                AddScriptDirectoryToEnvironmentPath(directory);
 
26
                        }
 
27
                }
 
28
                
 
29
                void AddScriptDirectoryToEnvironmentPath(string directory)
 
30
                {
 
31
                        var environmentPath = new PowerShellSessionEnvironmentPath(Session);
 
32
                        environmentPath.Append(directory);
 
33
                }
 
34
        }
 
35
}