Exemplo n.º 1
0
def move_document_to(source_doc_location, target_path):
    target_path = copy_document_to(source_doc_location, target_path)
    if (target_path is not None and delete_portable_src
            and is_file_exists(source_doc_location)
            and is_file_exists(target_path)):
        os.remove(source_doc_location)

    return target_path
Exemplo n.º 2
0
def get_rel_document_location(source_location, reference_location):
    if (is_url(source_location)):
        return source_location
    elif (is_file_exists(source_location)):
        return os.path.relpath(source_location,
                               os.path.dirname(reference_location))
    return None
Exemplo n.º 3
0
def resolve_document_location(referece_location, target_location):
    if (is_url(referece_location)):
        return os.path.join(referece_location, target_location)
    elif (is_file_exists(referece_location)):
        return os.path.join(referece_location, target_location)
    return None
Exemplo n.º 4
0
def get_rel_shell_path(source_location, reference_location):
    rel_source_location = get_rel_document_location(source_location,
                                                    reference_location)
    if (is_file_exists(source_location)):
        return os.path.join("`dirname $0`", rel_source_location)
    return rel_source_location
Exemplo n.º 5
0
def get_abs_document_location(source_location):
    if (is_url(source_location)):
        return source_location
    elif (is_file_exists(source_location)):
        return os.path.abspath(source_location)
    return None
Exemplo n.º 6
0
def document_exists(source_location):
    return is_url(source_location) and page_exists(
        source_location) or is_file_exists(source_location)