Add 'bam copy' command.
This commit is contained in:
@@ -123,3 +123,27 @@ def is_compressed_filetype(filepath):
|
||||
# '.gz', '.tgz',
|
||||
# '.zip',
|
||||
}
|
||||
|
||||
|
||||
def is_subdir(path, directory):
|
||||
"""
|
||||
Returns true if *path* in a subdirectory of *directory*.
|
||||
"""
|
||||
import os
|
||||
from os.path import normpath, normcase
|
||||
path = normpath(normcase(path))
|
||||
directory = normpath(normcase(directory))
|
||||
|
||||
if isinstance(directory, bytes):
|
||||
sep_i = ord(os.sep)
|
||||
sep = os.sep.encode('ascii')
|
||||
else:
|
||||
sep_i = os.sep
|
||||
sep = os.sep
|
||||
|
||||
directory = directory.rstrip(sep)
|
||||
if len(path) > len(directory):
|
||||
if path.startswith(directory):
|
||||
return (path[len(directory)] == sep_i)
|
||||
return False
|
||||
|
||||
|
Reference in New Issue
Block a user