Skip to content

Quick Reference

IlyaAI edited this page Apr 11, 2015 · 2 revisions

File System Path

File Sets

(to be continued)

File System Paths

let myPath = ~~"my/path"
var myPath = "my/path".AsPath();

Creates FileSystemPath object from string. Either / (slash) or \ (back slash) separators allowed but slash is preferred. Relative paths are evaluated against build script location.

let mySubPath = myPath / "sub"
var mySubPath = myPath / "sub";

Operator / combines parts of path. First operand must be FileSystemPath object second might be either FileSystemPath too or String.

let wellknownPath = ~~"[ProgramFiles]/MyApp"
var wellknownPath = "[ProgramFiles]/MyApp".AsPath();

[ProgramFiles] expanded into wellknown path. For possible values see System.Environment.SpecialFolder.

File Sets

let myFiles = !!"path/*"
var myFiles = "path/*".AsFileSet();

Creates FileSet object from string: all files from 'path' folder (w/o recursion).

let myFiles = !!"path/**/*"
var myFiles = "path/**/*".AsFileSet();

All files from 'path' folder and all its sub-folders.

let myFiles = !!"folder-*/*.txt"
var myFiles = "folder-*/*.txt".AsFileSet();

All .txt files from folders which start from 'folder-'.

let myFiles = !!"*" - "*.tmp"
var myFiles = "*".AsFileSet() - "*.tmp";

All files except .tmp files.

let myFiles = !!"*.exe" + "*.dll"
var myFiles = "*.exe".AsFileSet() + "*.dll";

All .exe and .dll files.

let myFiles = !!"bin/*.exe" + "bin/*.dll" + "plugins/*.dll"
Files.Copy(myFiles, ~~"target")
var myFiles = "bin/*.exe".AsFileSet() + "bin/*.dll" + "plugins/*.dll";
Files.Copy(myFiles, "target".AsPath());

Copies all .exe and .dll files from 'bin' folder to 'target/bin' folder and all .dll files from 'plugins' folder to 'target/plugins'.

let myFiles = ~~"*/bin/Release" % "*.exe" + "*.dll"
Files.Copy(myFiles, ~~"target")
var myFiles = "*/bin/Release".AsPath() % *.exe" + "*.dll";
Files.Copy(myFiles, "target".AsPath());

Copies all .exe and .dll files from all project's 'bin/Release' folders to 'target' (no sub-folders are created!). Operator % creates file set relative to folder passed as first operand.

Clone this wiki locally