{"id":16299989,"url":"https://github.com/froggs/p6-file-spec","last_synced_at":"2025-04-09T21:46:25.590Z","repository":{"id":4646769,"uuid":"5791976","full_name":"FROGGS/p6-File-Spec","owner":"FROGGS","description":null,"archived":false,"fork":false,"pushed_at":"2013-12-11T18:26:21.000Z","size":296,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-15T13:48:28.565Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FROGGS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-13T08:27:24.000Z","updated_at":"2014-09-09T04:57:14.000Z","dependencies_parsed_at":"2022-09-25T02:01:16.329Z","dependency_job_id":null,"html_url":"https://github.com/FROGGS/p6-File-Spec","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FROGGS%2Fp6-File-Spec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FROGGS%2Fp6-File-Spec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FROGGS%2Fp6-File-Spec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FROGGS%2Fp6-File-Spec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FROGGS","download_url":"https://codeload.github.com/FROGGS/p6-File-Spec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119439,"owners_count":21050754,"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":[],"created_at":"2024-10-10T20:49:58.348Z","updated_at":"2025-04-09T21:46:25.558Z","avatar_url":"https://github.com/FROGGS.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"p6-File-Spec\n============\n\n## Note\n\nThis module is obsolete since IO::Spec is implemented in rakudo.\n\nUsage:\n\n\tuse File::Spec;\n\tsay File::Spec.curdir;   #your current OS's curdir\n\tsay File::Spec.os('Win32').rootdir   # \"\\\" on any OS\n\nMethods (current state):\n\n\t                          Unix   Mac   Win32  VMS Cygwin\n\tcanonpath                 done  done   done        done\n\tno-parent-or-current-test done         done        done\n\tdevnull                   done  done   done  done  done\n\tcurdir                    done  done   done  done  done\n\tupdir                     done  done   done  done  done\n\trootdir                   done         done        done\n\ttmpdir                    done  done   done  done  done\n\tpath                      done         done  done  done\n\tfile-name-is-absolute     done  done   done  done  done\n\tsplit                     done         done   ~~   done\n\tjoin                      done         done   ~~   done\n\tsplitpath                 done  done   done   ~~   done\n\tcatpath                   done         done   ~~   done\n\tsplitdir                  done         done        done\n\tcatdir                    done         done        done\n\tcatfile                   done         done        done\n\tabs2rel                   done         done        done\n\trel2abs                   done         done        done\n\n'~~' means partially implemented, but not passing tests.\n\n## Ported methods\n\nSee [Perl 5 File::Spec](http://search.cpan.org/~smueller/PathTools-3.40/lib/File/Spec.pm) for now.  The methods are the same, but use dots instead of arrows.\n\n## Removed methods\n\nMethod `no_updirs` is gone, because its use case is handled automatically by `dir()`.  For the test that supplies dir with its functionality, see new method `no-parent-or-current-test`.\n\nMethod `case_tolerant` has moved to its own module, [File::Spec::Case](https://github.com/labster/p6-File-Spec-Case), and slightly changed its interface.\n\n## Changed methods\n\n### join\n\nThe method `join` is no longer an alias for `catfile`, but instead a unique function similar to `catpath`.  See the description of join in the New methods section.\n\n## New methods\n\n### os\n\nThe os method takes a single argument, an operating system string, and returns a File::Spec object for the appropriate OS.\n\n\tmy $mac_os_x_spec = File::Spec.os('darwin');\n\t\t# returns a File::Spec::Unix object\n\tmy $windows_spec = File::Spec.os('MSWin32');\n\t\t#returns File::Spec::Win32\n\tsay File::Spec.os('Win32').canonpath('C:\\\\foo\\\\.\\\\bar\\\\');\n\t\t# prints \"C:\\foo\\bar\"\n\nThe parameter can be either an operating system string, or the last part of the name of a subclass ('Win32', 'Mac').  The default is `$*OS`, which gives you the same subclass that File::Spec already uses for your system.\n\n\n### split\n\nA close relative of `splitdir`, this function also splits a path into volume, directory, and basename portions.  Unlike splitdir, path-components returns paths compatible with dirname and basename.\n\nThis means that trailing slashes will be eliminated from the directory and basename components, in Win32 and Unix-like environments.  The basename component will always contain the last part of the path, even if it is a directory, `'.'`, or `'..'`.  If a relative path's directory portion would otherwise be empty, the directory is set to `'.'`.\n\nOn systems with no concept of volume, returns `''` (the empty string) for volume.\n\n\t($volume, $directories, $basename) =\n\t\t\tFile::Spec.split( $path );\n\nThe results can be passed to `.join` to get back a path equivalent to (but not necessarily identical to) the original path.  If you want to keep all of the characters involved, use `.splitdir` instead.\n\n### Comparison of splitpath and split\n\n\tOS      Path       splitpath               split\n\tlinux   /a/b/c     (\"\", \"/a/b/\", \"c\")      (\"\", \"/a/b\", \"c\")\n\tlinux   /a/b//c/   (\"\", \"/a/b//c/\", \"\")    (\"\", \"/a/b\", \"c\")\n\tlinux   /a/b/.     (\"\", \"/a/b/.\", \"\")      (\"\", \"/a/b\", \".\")\n\tWin32   C:\\a\\b\\    (\"C:\", \"\\\\a\\\\b\\\\\", \"\")  (\"C:\", \"\\\\a\", \"b\")\n\tVMS     A:[b.c]    (\"A:\", \"[b.c]\", \"\")     (\"A:\", \"[b]\", \"[c]\")\n\n\n### join\n\nA close relative of `.catpath`, this function takes volume, directory and basename portions and returns an entire path.  If the dirname is `'.'`, it is removed from the (relative) path output, because this function inverts the functionality of dirname and basename.\n\n\t$full-path = File::Spec.join($volume, $dirname, $basename);\n\nDirectory separators are inserted if necessary.  Under Unix, $volume is ignored, and only directory and basename are concatenated.  On other OSes, $volume is significant.\n\nThis method is the inverse of `.split`; the results can be passed to it to get the volume, dirname, and basename portions back.\n\n\n### Comparison of catpath and join\n\n\tOS     Components            catpath        join\n\tlinux  (\"\", \"/a/b\", \"c\")     /a/b/c         /a/b/c\n\tlinux  (\"\", \".\", \"foo\")      ./foo          foo\n\tlinux  (\"\", \"/\", \"/\")        //             /\n\tWin32  (\"C:\", \"\\a\", \"b\")     C:\\a\\b         C:\\a\\b\n\tVMS    (\"A:\", \"[b]\", \"[c]\")  A:[b][c]       A:[b.c]\n\n### no-parent-or-current-test\n\nReturns a test as to whether a given path is identical to the parent or the current directory.  The `dir()` function automatically removes these for you in directory listings, so under normal circumstances you shouldn't need to use it directly.\n\n\t'file' ~~ File::Spec.no-parent-or-current-test    #False\n\t'.'    ~~ File::Spec.no-parent-or-current-test    #True\n\t'..'   ~~ File::Spec.no-parent-or-current-test    #True\n\nThis can, however, be used to extend `dir()` through its `$test` parameter:\n\n\tdir( \"my/directory\", test=\u003e\n\t\tall(File::Spec.no-parent-or-current-test, /^ '.' /));\n\nThis example would return all files begining with a period that are not `.` or `..` directories.\n\nThis replaces the functionality of the old `no-updirs` method.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffroggs%2Fp6-file-spec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffroggs%2Fp6-file-spec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffroggs%2Fp6-file-spec/lists"}