All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.malliina.values.UnixPath.scala Maven / Gradle / Ivy

The newest version!
package com.malliina.values

import java.nio.file.Path

/** @param path
  *   a path - all separators must be slashes ('/') regardless of platform
  */
case class UnixPath(path: String) extends WrappedString {
  def value: String = path
}

object UnixPath extends StringCompanion[UnixPath] {
  val UnixPathSeparator: Char = '/'
  val WindowsPathSeparator = '\\'
  val Empty: UnixPath = UnixPath("")

  def apply(path: Path): UnixPath = fromRaw(path.toString)

  def fromRaw(s: String): UnixPath = UnixPath(s.replace(WindowsPathSeparator, UnixPathSeparator))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy