os
Members list
Type members
Classlikes
Extractor to let you easily pattern match on os.Paths. Lets you do
Extractor to let you easily pattern match on os.Paths. Lets you do
@ val base/segment/filename = pwd
base: Path = Path(Vector("Users", "haoyi", "Dropbox (Personal)"))
segment: String = "Workspace"
filename: String = "Ammonite"
To break apart a path and extract various pieces of it.
Attributes
- Supertypes
- Self type
-
/.type
A path which is either an absolute Path, a relative RelPath, or a ResourcePath with shared APIs and implementations.
A path which is either an absolute Path, a relative RelPath, or a ResourcePath with shared APIs and implementations.
Most of the filesystem-independent path-manipulation logic that lets you splice paths together or navigate in and out of paths lives in this interface
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
trait BasePathImplclass Pathclass RelPathclass ResourcePathclass SubPathtrait FilePathtrait SegmentedPathShow all
Contains the accumulated output for the invocation of a subprocess command.
Contains the accumulated output for the invocation of a subprocess command.
Apart from the exit code, the primary data-structure is a sequence of byte chunks, tagged with Left for stdout and Right for stderr. This is interleaved roughly in the order it was emitted by the subprocess, and reflects what a user would have see if the subprocess was run manually.
Derived from that, is the aggregate out
and err
StreamValues, wrapping stdout/stderr respectively, and providing convenient access to the aggregate output of each stream, as bytes or strings or lines.
Attributes
- Supertypes
Simple enum with the possible filesystem objects a path can resolve to
Attributes
- Companion
- class
- Supertypes
- Self type
-
GlobInterpolator.type
Inherit the input/output stream from the current process. Identical of os.Inherit, except it cannot be redirected globally
Inherit the input/output stream from the current process. Identical of os.Inherit, except it cannot be redirected globally
Attributes
- Supertypes
- Self type
-
InheritRaw.type
An absolute path on the filesystem. Note that the path is normalized and cannot contain any empty ""
, "."
or ".."
segments
An absolute path on the filesystem. Note that the path is normalized and cannot contain any empty ""
, "."
or ".."
segments
Attributes
- Companion
- object
- Supertypes
-
trait BasePathImpltrait ReadablePathtrait FilePathtrait BasePathclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait ProcessOutputclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
class ArrayPathChunk[T]class RelPathChunkclass SeqPathChunk[T]class StringPathChunkclass SubPathChunkclass SymbolPathChunkShow all
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
object JavaIoFileConvertible.typeobject NioPathConvertible.typeobject StringConvertible.typeobject UriPathConvertible.type
Attributes
- Companion
- trait
- Supertypes
- Self type
-
PathConvertible.type
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait ProcessOutputtrait ProcessInputclass Objecttrait Matchableclass AnyShow all
A set of permissions; can be converted easily to the rw-rwx-r-x form via toString, or to a set of PosixFilePermissions via toSet and the other way via PermSet.fromString
/PermSet.fromSet
Pipe the input/output stream to the current process to be used via java.lang.Process#{getInputStream,getOutputStream,getErrorStream}
Pipe the input/output stream to the current process to be used via java.lang.Process#{getInputStream,getOutputStream,getErrorStream}
Attributes
- Supertypes
- Self type
-
Pipe.type
Attributes
- Companion
- object
- Supertypes
Attributes
- Companion
- class
- Supertypes
- Self type
-
PosixStatInfo.type
A group of processes that are piped together, corresponding to e.g. ls -l | grep .scala
. You can create a ProcGroup
by calling .pipeTo
on a proc multiple times. Contains methods corresponding to the methods on proc, but defined for pipelines of processes.
Represents the configuration of a SubProcess's input stream. Can either be os.Inherit, os.Pipe, os.Path or a os.Source
Represents the configuration of a SubProcess's input stream. Can either be os.Inherit, os.Pipe, os.Path or a os.Source
Attributes
- Companion
- object
- Supertypes
- Known subtypes
Attributes
- Companion
- trait
- Supertypes
- Self type
-
ProcessInput.type
Parent type for single processes and process pipelines.
Parent type for single processes and process pipelines.
Attributes
- Supertypes
- Known subtypes
-
class ProcessPipelineclass SubProcess
Represents the configuration of a SubProcess's output or error stream. Can either be os.Inherit, os.Pipe, os.Path or a os.ProcessOutput
Represents the configuration of a SubProcess's output or error stream. Can either be os.Inherit, os.Pipe, os.Path or a os.ProcessOutput
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
object Inherit.typeobject InheritRaw.typeclass PathAppendRedirectclass PathRedirectobject Pipe.typeclass ReadBytesclass ReadlinesShow all
Attributes
- Companion
- trait
- Supertypes
- Self type
-
ProcessOutput.type
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
- Known subtypes
-
class Pathclass ResourcePath
A relative path on the filesystem. Note that the path is normalized and cannot contain any empty or ".". Parent ".." segments can only occur at the left-end of the path, and are collapsed into a single number ups.
A relative path on the filesystem. Note that the path is normalized and cannot contain any empty or ".". Parent ".." segments can only occur at the left-end of the path, and are collapsed into a single number ups.
Attributes
- Companion
- object
- Supertypes
-
trait SegmentedPathtrait BasePathImpltrait FilePathtrait BasePathclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
- Self type
-
ResourcePath.type
Represents path to a resource on the java classpath.
Represents path to a resource on the java classpath.
Classloaders are tricky: http://stackoverflow.com/questions/12292926
Attributes
- Companion
- object
- Supertypes
-
trait SegmentedPathtrait ReadablePathtrait BasePathImpltrait BasePathclass Objecttrait Matchableclass AnyShow all
Represents a possible root where classpath resources can be loaded from; either a ResourceRoot.ClassLoader or a ResourceRoot.Class. Resources loaded from classloaders are always loaded via their absolute path, while resources loaded via classes are always loaded relatively.
Represents a possible root where classpath resources can be loaded from; either a ResourceRoot.ClassLoader or a ResourceRoot.Class. Resources loaded from classloaders are always loaded via their absolute path, while resources loaded via classes are always loaded relatively.
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
class Classclass ClassLoader
Attributes
- Companion
- trait
- Supertypes
- Self type
-
ResourceRoot.type
A source which is guaranteeds to provide a SeekableByteChannel
A source which is guaranteeds to provide a SeekableByteChannel
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
class ChannelSource
Attributes
- Companion
- trait
- Supertypes
- Self type
-
SeekableSource.type
Attributes
- Supertypes
- Known subtypes
An implicit wrapper defining the things that can be "interpolated" directly into a subprocess call.
An implicit wrapper defining the things that can be "interpolated" directly into a subprocess call.
Attributes
- Companion
- object
- Supertypes
A source of bytes; must provide either an InputStream or a SeekableByteChannel to read from. Can be constructed implicitly from strings, byte arrays, inputstreams, channels or file paths
A source of bytes; must provide either an InputStream or a SeekableByteChannel to read from. Can be constructed implicitly from strings, byte arrays, inputstreams, channels or file paths
Attributes
- Companion
- object
- Supertypes
- Known subtypes
Attributes
The result from doing an system stat
on a particular path.
The result from doing an system stat
on a particular path.
Note: ctime is not same as ctime (Change Time) in stat
, it is creation time maybe fall back to mtime if system not supported it.
Created via stat! filePath
.
If you want more information, use stat.full
Attributes
- Companion
- object
- Supertypes
A relative path on the filesystem, without any ..
or .
segments
A relative path on the filesystem, without any ..
or .
segments
Attributes
- Companion
- object
- Supertypes
-
trait SegmentedPathtrait BasePathImpltrait FilePathtrait BasePathclass Objecttrait Matchableclass AnyShow all
Represents a spawn subprocess that has started and may or may not have completed.
Represents a spawn subprocess that has started and may or may not have completed.
Attributes
- Companion
- object
- Supertypes
Attributes
- Companion
- class
- Supertypes
- Self type
-
SubProcess.type
Thrown when a shellout command results in a non-zero exit code.
Thrown when a shellout command results in a non-zero exit code.
Doesn't contain any additional information apart from the CommandResult that is normally returned, but ensures that failures in subprocesses happen loudly and won't get ignored unless intentionally caught
Attributes
- Supertypes
Copy a file or folder from one path to another. Recursively copies folders with all their contents. Errors out if the destination path already exists, or is within the source path.
Attempts to any symbolic links in the given path and return the canonical path. Returns None
if the path cannot be resolved (i.e. some symbolic link in the given path is broken)
Attempts to any symbolic links in the given path and return the canonical path. Returns None
if the path cannot be resolved (i.e. some symbolic link in the given path is broken)
Attributes
- Supertypes
- Self type
-
followLink.type
Get the owning group of the file/folder at the given path
Get the owning group of the file/folder at the given path
Attributes
- Supertypes
- Self type
-
group.type
Returns all the files and folders directly within the given folder. If the given path is not a folder, raises an error. Can be called with list.stream to return an iterator. To list files recursively, use walk
Returns all the files and folders directly within the given folder. If the given path is not a folder, raises an error. Can be called with list.stream to return an iterator. To list files recursively, use walk
For convenience os.list
sorts the entries in the folder before returning them. You can disable sorted by passing in the flag sort = false
.
Attributes
- Supertypes
- Self type
-
list.type
Create a single directory at the specified path. Optionally takes in a PermSet to specify the filesystem permissions of the created directory.
Create a single directory at the specified path. Optionally takes in a PermSet to specify the filesystem permissions of the created directory.
Errors out if the directory already exists, or if the parent directory of the specified path does not exist. To automatically create enclosing directories and ignore the destination if it already exists, using os.makeDir.all
Attributes
- Supertypes
- Self type
-
makeDir.type
Moves a file or folder from one path to another. Errors out if the destination path already exists, or is within the source path.
Get the owner of the file/folder at the given path
Convenience APIs around java.lang.Process and java.lang.ProcessBuilder:
Convenience APIs around java.lang.Process and java.lang.ProcessBuilder:
-
os.proc.call provides a convenient wrapper for "function-like" processes that you invoke with some input, whose entire output you need, but otherwise do not have any intricate back-and-forth communication
-
os.proc.stream provides a lower level API: rather than providing the output all at once, you pass in callbacks it invokes whenever there is a chunk of output received from the spawned process.
-
os.proc(...) provides the lowest level API: an simple Scala API around java.lang.ProcessBuilder, that spawns a normal java.lang.Process for you to deal with. You can then interact with it normally through the standard stdin/stdout/stderr streams, using whatever protocol you want
Attributes
- Supertypes
Reads the contents of a os.Path or other os.Source as a java.lang.String
. Defaults to reading the entire file as UTF-8, but you can also select a different charSet
to use, and provide an offset
/count
to read from if the source supports seeking.
Roughly equivalent to bash's rm -rf
. Deletes any files or folders in the target path, or does nothing if there aren't any
Gets the size of the given file or folder
Gets the size of the given file or folder
Throws an exception if the file or folder does not exist
When called on folders, returns the size of the folder metadata (i.e. the list of children names), and not the size of the folder's recursive contents. Use os.walk if you want to sum up the total size of a directory tree.
Attributes
- Supertypes
- Self type
-
size.type
Reads in the basic filesystem metadata for the given file. By default follows symbolic links to read the metadata of whatever the link is pointing at; set followLinks = false
to disable that and instead read the metadata of the symbolic link itself.
Reads in the basic filesystem metadata for the given file. By default follows symbolic links to read the metadata of whatever the link is pointing at; set followLinks = false
to disable that and instead read the metadata of the symbolic link itself.
Throws an exception if the file or folder does not exist
Attributes
- Supertypes
- Self type
-
stat.type
Alias for java.nio.file.Files.createTempFile
and java.io.File.deleteOnExit
. Pass in deleteOnExit = false
if you want the temp file to stick around.
Recursively walks the given folder and returns the paths of every file or folder within.
Recursively walks the given folder and returns the paths of every file or folder within.
You can pass in a skip
callback to skip files or folders you are not interested in. This can avoid walking entire parts of the folder hierarchy, saving time as compared to filtering them after the fact.
By default, the paths are returned as a pre-order traversal: the enclosing folder is occurs first before any of it's contents. You can pass in preOrder = false
to turn it into a post-order traversal, such that the enclosing folder occurs last after all it's contents.
os.walk
returns but does not follow symlinks; pass in followLinks = true
to override that behavior. You can also specify a maximum depth you wish to walk via the maxDepth
parameter.
Attributes
- Supertypes
- Self type
-
walk.type
Write some data to a file. This can be a String, an Array[Byte], or a Seq[String] which is treated as consecutive lines. By default, this fails if a file already exists at the target location. Use write.over or write.append if you want to over-write it or add to what's already there.
Write some data to a file. This can be a String, an Array[Byte], or a Seq[String] which is treated as consecutive lines. By default, this fails if a file already exists at the target location. Use write.over or write.append if you want to over-write it or add to what's already there.
Attributes
- Supertypes
- Self type
-
write.type
Value members
Concrete methods
The current working directory for this process.
The current working directory for this process.