@ -39,6 +39,10 @@ def _check_system_path_is(nature, path, fail=True):
return answer
return answer
def system_path ( path ) :
return os . path . abspath ( os . path . expanduser ( path ) )
def check_file ( path , fail = True ) :
def check_file ( path , fail = True ) :
syspath = system_path ( path )
syspath = system_path ( path )
return ( _check_system_path_exists ( syspath , fail = fail )
return ( _check_system_path_exists ( syspath , fail = fail )
@ -64,10 +68,6 @@ def write_file(filepath, data):
f . write ( data )
f . write ( data )
def system_path ( path ) :
return os . path . abspath ( os . path . expanduser ( path ) )
# dealing with formatless content
# dealing with formatless content
def content_type ( path ) :
def content_type ( path ) :
@ -118,6 +118,8 @@ def get_content(path, ui=None):
def move_content ( source , target , overwrite = False ) :
def move_content ( source , target , overwrite = False ) :
source = system_path ( source )
target = system_path ( target )
if source == target :
if source == target :
return
return
if not overwrite and os . path . exists ( target ) :
if not overwrite and os . path . exists ( target ) :
@ -126,6 +128,8 @@ def move_content(source, target, overwrite = False):
def copy_content ( source , target , overwrite = False ) :
def copy_content ( source , target , overwrite = False ) :
source = system_path ( source )
target = system_path ( target )
if source == target :
if source == target :
return
return
if not overwrite and os . path . exists ( target ) :
if not overwrite and os . path . exists ( target ) :