Esempio n. 1
0
def get_removable_volume_info(f):
    """
    Returns the root uri of the volume, and local path of the 
    group config file
    """
    rooturi = f.get_removable_volume_root_uri()
    if rooturi:
        path = Vfs.uri_to_local_path(rooturi)
        if path:
            path = Vfs.uri_join(path, ".conduit")
            return rooturi, path
    return None, None
Esempio n. 2
0
def get_removable_volume_info(f):
    """
    Returns the root uri of the volume, and local path of the 
    group config file
    """
    rooturi = f.get_removable_volume_root_uri()
    if rooturi:
        path = Vfs.uri_to_local_path(rooturi)
        if path:
            path = Vfs.uri_join(path, ".conduit")
            return rooturi,path
    return None,None
Esempio n. 3
0
ok("Scanned /tmp ok - found %s" % fileuri, "file://"+fileuri in t1.get_uris())
ok("Scanned %s ok (empty)" % tmpdiruri, t2.get_uris() == [])

# Test the volume management stuff
ntfsUri = get_external_resources('folder')['ntfs-volume']
if Vfs.uri_exists(ntfsUri):
    fstype = Vfs.uri_get_filesystem_type(ntfsUri)
    ok("Get filesystem type (%s)" % fstype,fstype == "ntfs", False)
    #ok("Escape illegal chars in filenames", 
    #        Vfs.uri_sanitize_for_filesystem("invalid:name","ntfs") == "invalid name")
    #ok("Escape illegal chars in uris", 
    #        Vfs.uri_sanitize_for_filesystem("file:///i:n/i:n","ntfs") == "file:///i n/i n")

localUri = get_external_resources('folder')['folder']
ok("Local uri --> path", Vfs.uri_to_local_path(localUri) == "/tmp")
ok("Local uri not removable", Vfs.uri_is_on_removable_volume(localUri) == False)

removableUri = get_external_resources('folder')['removable-volume']
if Vfs.uri_exists(removableUri):
    fstype = Vfs.uri_get_filesystem_type(removableUri)
    ok("Get filesystem type (%s)" % fstype,fstype in ("vfat","msdos"))
    ok("Removable volume detected removable", Vfs.uri_is_on_removable_volume(removableUri))
    ok("Removable volume calculate root path", Vfs.uri_get_volume_root_uri(removableUri).startswith("file:///media/"))

URIS_TO_JOIN = (
    (   ("file:///foo/bar","gax","ssss"),   
        "file:///foo/bar/gax/ssss"),
    (   ("smb://192.168.1.1","Disk-2","Travel%20Videos/","Switzerland"),
        "smb://192.168.1.1/Disk-2/Travel%20Videos/Switzerland"),
    (   ("ssh://[email protected]/home","john","phd"),