Path.symlink

Create symlink for this file in dest path.

struct Path
version(Posix)
@safe const
void
symlink
()

Parameters

dest Path

Destination path.

Throws

FileException

Examples

import dshould;
Path root = createTempPath();
scope(exit) root.remove();

// Create a file in some directory
root.join("test-dir", "subdir").mkdir(true);
root.join("test-dir", "subdir", "test-file.txt").writeFile("Hello!");

// Create a symlink for created file
root.join("test-dir", "subdir", "test-file.txt").symlink(
    root.join("test-symlink.txt"));

// Test that symlink was created
root.join("test-symlink.txt").exists.should.be(true);
root.join("test-symlink.txt").isSymlink.should.be(true);
root.join("test-symlink.txt").readFile.should.equal("Hello!");

Meta