コード例 #1
0
ファイル: go.py プロジェクト: richsmith/fluidic
def execute(input, options, environment):

    assert len(options) == 0 or len(options) == 1

    if input != None:

        assert isinstance(input, iotypes.Directory)
        path = input.path
    elif len(options) != 0:
        path = access.interpret_path(options[0])
    else:
        path = access.interpret_path("~")
        
    if not os.path.exists(path):
        raise IOError(html.strong(path) + ' is not accessible')
    elif not os.path.isdir(path):
        raise IOError(html.strong(path) + ' is not a directory')
    else:
        try:
            os.chdir(path)
        except Exception as error:
            raise IOError("Can't move to " + html.strong(path) + \
                "; error is:" + html.br() + str(error))
コード例 #2
0
ファイル: iotypes.py プロジェクト: richsmith/fluidic
 def __init__(self, path):
     if not access.is_valid_path(path):
         message = "File at " + html.strong(path) + " is not accessible"
         raise Exception(message)
     self.path = path