about summary refs log tree commit homepage
path: root/lib/dtas/player/client_handler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dtas/player/client_handler.rb')
-rw-r--r--lib/dtas/player/client_handler.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb
index aabd1ab..b3c208d 100644
--- a/lib/dtas/player/client_handler.rb
+++ b/lib/dtas/player/client_handler.rb
@@ -449,4 +449,15 @@ module DTAS::Player::ClientHandler
       io.emit("ERR unknown source op")
     end
   end
+
+  def chdir_handler(io, msg)
+    msg.size == 1 or return io.emit("ERR usage: cd DIRNAME")
+    begin
+      Dir.chdir(msg[0])
+    rescue => e
+      return io.emit("ERR chdir: #{e.message}")
+    end
+    # echo(%W(cd msg[0])) # should we broadcast this?
+    io.emit("OK")
+  end
 end