Skip to content

Korthax/Cake.Path

Repository files navigation

Cake.Path

A Cake AddIn that extends Cake with the ability to add items to the PATH.

cakebuild.net NuGet Version

Dependencies

  • Cake v0.17

Including the AddIn

#addin "Cake.Path"

Usage

#addin "Cake.Path"

...

Task("AddToPath")
    .Does(() => 
    {
        AddToPath("C:\\Python27\\");
    });

Task("AddToPathWithSettings")
    .Does(() => 
    {
        var settings = new PathSettings {
           Target = PathTarget.User // Target is only available in net45
        }
        
        AddToPath("C:\\Python27\\", settings);
    });

Task("RemoveFromPath")
    .Does(() => 
    {
        RemoveFromPath("C:\\Python27\\");
    });

Task("RemoveFromPathWithSettings")
    .Does(() => 
    {
        var settings = new PathSettings {
           Target = PathTarget.Machine // Target is only available in net45
        }
        
        RemoveFromPath("C:\\Python27\\", settings);
    });

Task("ReloadPath")
    .Does(() => 
    {
        ReloadPath();
    });

Task("GetEnvironmentPath")
    .Does(() => 
    {
        string path = GetEnvironmentPath();
    });

Task("GetEnvironmentPathWithSettings")
    .Does(() => 
    {
        var settings = new PathSettings {
           Target = PathTarget.Machine // Target is only available in net45
        }
        
        string path = GetEnvironmentPath(settings);
    });

General Notes

Please note Target is only available on net45

This is an initial version and not tested thoroughly.

I've made these AddIns for use in my own cake scripts therefore they have only been tested on Windows.