Skip to content

obiwanjacobi/Jacobi.Path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduces a PathInfo struct that contains a Directory or File path.

Usage

using Jacobi.Path;

Allows for easy path concatenation:

PathInfo path = "root" / "folder" / "file.txt";

All kinds of handy properties:

PathInfo path = "root" / "folder" / "file.txt";

var kind = path.Kind;             // PathInfoKind.File
var dirName = path.DirectoryName; // 'root/folder'
var fileName = path.FileName;     // 'file.txt'
var isRooted = path.IsRooted;     // false

Folder specifics:

PathInfo path = "root" / "folder" / "sub";

var kind = path.Kind;               // PathInfoKind.Directory
var fileNames = path.GetFileNames;  // files in root/folder/sub

Helpers:

var currentDir = PathInfo.CurrentDirectory;
var userProfile = PathInfo.UserProfile;
var tempFile = PathInfo.TempFile;
var paths = PathInfo.PathEnvironmentVariable;

Filtering / searching:

PathInfo path = "root" / "folder" / "sub";
PathFilter filter = new("*.txt")                // find '*.txt'
  {
    SearchOption = SearchOption.AllDirectories, // this dir and sub dirs
    MaxRecursion = 3,                           // max 3 levels deep
    Kind = PathFilterKind.Files,                // we want files as result
  };
var results = path.Filter(filter);
// all '.txt' files in 'root/folder/sub' and max 3 levels deep sub folders.

About

PathInfo with easy / concat and filtering.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages