Skip to content

os.rel / os.sub should accept a "." #381

Open
@lefou

Description

@lefou

This limitation is hitting Mill in its Task.Source which is accepting a os.SubPath. Since the idea is to provide a directory relative to an implicitly provided base directory, it is currently not possible to refer to that exact same directory without using it explicitly.

Definition of Task.Source:

inline def Source(inline value: os.SubPath)(implicit inline ctx: mill.define.Ctx)

While specifying a sub-directory works:

Task.Source("src")

Using the base dir does not:

Task.Source(".")

//           |Task.Source(".")
//
// [error]   │             ^^^
// [error]   │Exception occurred while executing macro expansion.
// [error]   │os.PathError$InvalidSegment: [.] is not a valid path segment. Literal path sequence [.] doesn't affect path being formed, please remove it
// [error]   │     at os.PathError$InvalidSegment$.apply(Path.scala:268)
// [error]   │     at os.PathChunk$.segmentsFromStringLiteralValidation(Path.scala:43)
// [error]   │     at os.Macros$.stringSubPathValidatedImpl(Macros.scala:58)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions