{"id":17999682,"url":"https://github.com/neoneye/swiftyrelativepath","last_synced_at":"2025-03-26T06:31:44.249Z","repository":{"id":63919077,"uuid":"118284998","full_name":"neoneye/SwiftyRelativePath","owner":"neoneye","description":"Swift equivalent of Ruby's \"Pathname.relative_path_from()\"","archived":false,"fork":false,"pushed_at":"2018-01-21T02:44:28.000Z","size":11,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T09:35:20.480Z","etag":null,"topics":["filemanager","nsfilemanager","nsurl","swift","url"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/neoneye.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-20T22:13:55.000Z","updated_at":"2025-01-19T11:28:44.000Z","dependencies_parsed_at":"2023-01-14T14:00:52.154Z","dependency_job_id":null,"html_url":"https://github.com/neoneye/SwiftyRelativePath","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoneye%2FSwiftyRelativePath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoneye%2FSwiftyRelativePath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoneye%2FSwiftyRelativePath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoneye%2FSwiftyRelativePath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neoneye","download_url":"https://codeload.github.com/neoneye/SwiftyRelativePath/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245603843,"owners_count":20642895,"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":["filemanager","nsfilemanager","nsurl","swift","url"],"created_at":"2024-10-29T22:14:12.096Z","updated_at":"2025-03-26T06:31:43.842Z","avatar_url":"https://github.com/neoneye.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftyRelativePath\n\nThis is a Swift equivalent of Ruby's [`Pathname.relative_path_from()`](https://ruby-doc.org/stdlib-2.5.0/libdoc/pathname/rdoc/Pathname.html#method-i-relative_path_from)\nor Java's [`Path.relativize()`](https://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html#relativize).\n\n\nExample of inputs and outputs:\n\n    | Long Path                 | Relative to Path | Return Value      |\n    |---------------------------|------------------|-------------------|\n    | /usr/X11/agent/47.gz      | /usr/X11         | agent/47.gz       |\n    | /usr/share/man/meltdown.1 | /usr/share/cups  | ../man/meltdown.1 |\n    | /var/logs/x/y/z/log.txt   | /var/logs        | x/y/z/log.txt     |\n\n\n\n# Usage\n\n    import SwiftyRelativePath\n    \n    let url0 = URL(fileURLWithPath: \"/computer/qubit/17\")\n    let url1 = URL(fileURLWithPath: \"/computer/lab\")\n    let path = url0.relativePath(from: url1)\n    // path is \"../qubit/17\"\n\n\n# Credits\n\n- [Martin R](https://chat.stackoverflow.com/users/1187415/martin-r). Thank you for [your answer](https://stackoverflow.com/a/48360631/78336) on stackoverflow.\n- [neoneye](https://github.com/neoneye)\n\n\n# License\n\nMIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoneye%2Fswiftyrelativepath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneoneye%2Fswiftyrelativepath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoneye%2Fswiftyrelativepath/lists"}