{"id":15426797,"url":"https://github.com/porges/pathy","last_synced_at":"2025-03-28T04:47:29.854Z","repository":{"id":66289396,"uuid":"73598530","full_name":"Porges/Pathy","owner":"Porges","description":"A library for safe typed path manipulation","archived":false,"fork":false,"pushed_at":"2017-07-14T05:47:02.000Z","size":41,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T05:44:17.937Z","etag":null,"topics":["c-sharp","paths"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Porges.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-13T06:00:41.000Z","updated_at":"2022-02-18T21:19:51.000Z","dependencies_parsed_at":"2023-05-01T22:47:30.333Z","dependency_job_id":null,"html_url":"https://github.com/Porges/Pathy","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"58670629b855c7f063d6e561eafcda5d03db7249"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Porges%2FPathy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Porges%2FPathy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Porges%2FPathy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Porges%2FPathy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Porges","download_url":"https://codeload.github.com/Porges/Pathy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245972671,"owners_count":20702721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-sharp","paths"],"created_at":"2024-10-01T17:58:04.248Z","updated_at":"2025-03-28T04:47:29.808Z","avatar_url":"https://github.com/Porges.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pathy [![Build status](https://ci.appveyor.com/api/projects/status/awr5tpw9n1wj17ax?svg=true)](https://ci.appveyor.com/project/Porges/pathy)\n\n\nPathy is a library for safe, typed path manipulation.\n\n## Type axes\n\nPaths are either *absolute* or *relative* and point at *directories* or *files*.\n\n\nCombining these two axes results in the following hierarchy:\n\n* `AnyPath` – any path\n  * `AnyFilePath` – any path to a file\n    * `FilePath` – an absolute path to a file\n    * `RelativeFilePath` – a relative path to a file\n      * `FileName` – a relative path to a file, without directory components\n  * `AnyDirectoryPath` – any path to a directory\n    * `DirectoryPath` – an absolute path to a directory\n    * `RelativeDirectoryPath` – a relative path to a directory\n\n:warning: Pathy *has opinions*, so it gives shorter names to absolute paths to encourage their use.\n\n## The `/` operator\n\nThe `/` operator is the main reason that Pathy exists. It allows you to combine paths in a safe manner.\n\nIt can be used with the following combinations of types:\n\n|     `below / right`      |  RelativeDirectoryPath   |  RelativeFilePath   |\n| :----------------------: | :----------------------: | :-----------------: |\n| (Absolute) DirectoryPath | (Absolute) DirectoryPath | (Absolute) FilePath |\n|  RelativeDirectoryPath   |  RelativeDirectoryPath   |  RelativeFilePath   |\n|     AnyDirectoryPath     |     AnyDirectoryPath     |     AnyFilePath     |\n\n## Long paths\n\nPathy is based on .NET 4.6.2, so supports long paths out of the box.\n\n## Formatting\n\nPathy includes support for formatting paths to particular widths. If the requested width is less than the path length, it will be truncated using ellipses. For example:\n\n```csharp\n    var path = FilePath.From(@\"C:\\path\\to\\a\\file.txt\")\n    Console.WriteLine($\"{path:20}\");\n```\n\nThe output of this is is `C:\\path\\...\\file.txt`.\n\n\u003e ​ :information_source: This feature is powered by Win32 functions, so matches what you see in `explorer.exe`.\n\n## Comparisons\n\nOnly paths of the exact same type should be compared. Pathy does not support comparing a relative path to an absolute one, as in general this doesn't make sense. Unfortunately .NET places `GetHashCode` \u0026 `Equals` on the root `object` type, so there's no sane way to prevent you from doing this (just as there’s no way to prevent you from asking `10.Equals(\"10\")`). Just don’t.\n\nThe one exception to this rule is that `FileName`s can be compared with `RelativeFilePath`s.\n\n## Sorting\n\nPathy supports logical sorting. This means that numeric groups in paths are compared by their numeric value and not their ASCII-betical value.\n\nLogical sorting is not the default since its behaviour may change, so it should only be used for display purposes. To use logical sorting, use `PathComparer.Logical\u003cT\u003e()`\n\n\n\n\u003e :information_source: This feature is also powered by Windows, so matches what you see in `explorer.exe`.\n\n\n## TODO\n\nRelative paths are not normalized, so comparing them can have inconsistent results.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fporges%2Fpathy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fporges%2Fpathy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fporges%2Fpathy/lists"}