Skip to content
/ pathlib Public
forked from Manuzor/pathlib

Object-oriented filesystem path manipulation inspired by the python library `pathlib`.

Notifications You must be signed in to change notification settings

k2aj/pathlib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pathlib

Inspired by the python library pathlib.

Differences to the python library API

+ Addition | - Removal | $ Change

    • There are no PureXPath base classes.
    • No PureXPath base classes.
    • No inheritance tree.
  • $ Most operations/functions are D module functions but can be called as if they were members (thanks to D's unified function call syntax UFCS).
  • $ as_posix() => posixData().
    • asPosix() to convert between different paths.
    • asNormalized() to normalize a path, without resolving it. This works for all types of paths, regardless of the current system.
  • as_posix() => posixData(). Additionally, there is also windowsData().
  • $ Instead of overloading operator /, the concatenation operator ~ is overloaded instead: Path("hello") ~ "world" ~ "goodBye // WindowsPath("hello\world\goodBye") or PosixPath("hello/world/goodBye")
  • $ Instead of suffix() and suffixes() there are extension(), extensions(), and fullExtension().
  • $ While pythons pathlib usually uses '/' as the path segment separator, we try to maintain the separator for the current type of path as much as possible.
  • $ Instead of providing rglob(), glob() accepts an optional SpanMode parameter. The type SpanMode is a public import from std.file.
    • copyFileTo() To copy one file to some destination and copyTo() to copy either files or directories (not unlike cp -r).

About

Object-oriented filesystem path manipulation inspired by the python library `pathlib`.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • D 97.6%
  • Makefile 2.4%