Skip to content

Commit

Permalink
[Truffle] Add File.symlink POSIX node.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjfish committed Apr 24, 2015
1 parent 46f43bb commit e371995
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/file/symlink_tags.txt
@@ -1,6 +1,2 @@
fails:File.symlink creates a symlink between a source and target file
fails:File.symlink creates a symbolic link
fails:File.symlink accepts args that have #to_path methods
fails:File.symlink raises an Errno::EEXIST if the target already exists
fails:File.symlink? returns true if the file is a link
fails:File.symlink? accepts an object that has a #to_path method
Expand Up @@ -318,4 +318,22 @@ public int isATTY(int fd) {

}

@CoreMethod(names = "symlink", isModuleFunction = true, required = 2)
public abstract static class SymlinkNode extends CoreMethodNode {

public SymlinkNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public SymlinkNode(SymlinkNode prev) {
super(prev);
}

@Specialization
public int symlink(RubyString first, RubyString second) {
return posix().symlink(first.toString(), second.toString());
}

}

}

0 comments on commit e371995

Please sign in to comment.