Skip to content

file-system and locators cleanup #1728

@cgay

Description

@cgay

Some issues I've noticed while doing a bit of work on the System library:

  • expand-pathname is totally different on Unix and Windows. Unix only expands "~" and "~user" in the first element of a relative path. Windows only calls GetFullPathnameA, which doesn't appear to do anything related to user expansion and is also the function called to implement resolve-file.
  • file-type on Windows will never return #"link". Windows has had symlinks since Vista. Looks like we can use FILE_ATTRIBUTE_REPARSE_POINT to determine whether a file is a symlink.
  • Comments in rename-file piss and moan about having to check if the destination exists. We might be able to avoid that if RENAME_EXCL is commonly supported.
  • Similar comments in copy-file. See copy-file is implemented by shelling out to /bin/cp on Unix platforms #1649 and check for something similar to RENAME_EXCL.
  • Define constants for the supported file properties. Easy to misspell #"writeable?", particularly easy to leave off the ?.
  • do-directory(fn, dir, descend?: #t, match: glob("*.dylan")) would be nice rather than having to recurse manually. Or could be a new function, scan-directory or something.
  • directory-empty? returns true if the directory doesn't exist. Why is it not an error?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions