Method: Roby::Application.read_current_dir

Defined in:
lib/roby/app.rb

.read_current_dir(current_path) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Read and validate the ‘current’ dir by means of the ‘current’ symlink that Roby maintains in its log base directory

Parameters:

  • current_path (String)

    the path to the ‘current’ symlink



1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
# File 'lib/roby/app.rb', line 1742

def self.read_current_dir(current_path)
    unless File.symlink?(current_path)
        raise ArgumentError,
              "#{current_path} does not exist or is not a symbolic link"
    end

    resolved_path = File.readlink(current_path)
    if !File.exist?(resolved_path)
        raise ArgumentError,
              "#{current_path} points to #{resolved_path}, which does not exist"
    elsif !File.directory?(resolved_path)
        raise ArgumentError,
              "#{current_path} points to #{resolved_path}, "\
              "which is not a directory"
    end
    resolved_path
end