10000 GitHub - jsakamoto/Toolbelt.WorkDirectory: Create a temporary working directory, copy files from a template, and finally, delete the working directory altogether when exiting a scope.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Create a temporary working directory, copy files from a template, and finally, delete the working directory altogether when exiting a scope.

License

Notifications You must be signed in to change notification settings

jsakamoto/Toolbelt.WorkDirectory

Repository files navigation

Toolbelt.WorkDirectory NuGet Package

Summary

Create a temporary working directory, copy files from a template, and finally, delete the working directory altogether when exiting a scope.

Examples

using Toolbelt;

// Create a temporary working directory under the application domain's base directory.
using var workDir = new WorkDirectory();

// The working directory name is a base36 string, like "ua6i0t8k6n".
Console.WriteLine($"Working directory created at: {workDir.Path}");

// Use the working directory
// ...

// The working directory object can be used as a string.
File.WriteAllText(Path.Combine(workDir, "test.txt"), "Hello, World!");

// The working directory is automatically deleted here
using Toolbelt;

// Create a temporary working directory and copy files from a source directory,
// excluding "bin" and "obj" directories.
using var workDir = WorkDirectory.CreateCopyFrom("path/to/source", (file) => file.Name is not "bin" and not "obj");

// Use the working directory
// ...

// The working directory is automatically deleted here

Release Notes

Release Notes

License

Mozilla Public License Version 2.0

About

Create a temporary working directory, copy files from a template, and finally, delete the working directory altogether when exiting a scope.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0