Skip to content

Commit

Permalink
add setcwd()
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jul 3, 2011
1 parent 677847a commit c6f4b8a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions j/libc.j
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ function getcwd()
end
string(p)
end

function setcwd(p::String)
if ccall(dlsym(libc, :chdir), Int32, (Ptr{Uint8},), p) == -1
throw(SystemError("setcwd"))
end
getcwd()
end

2 comments on commit c6f4b8a

@StefanKarpinski
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not call this chdir?

@JeffBezanson
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Analogy to getcwd()

Please sign in to comment.