get_fpath¶
-
sknano.core.io.
get_fpath
(fname=None, ext=None, outpath='/home/androo/projects/scikit-nano/scikit-nano/doc/source', overwrite=False, add_fnum=True, fnum=None, include_fname=False, fname_only=False, verbose=False)[source] [edit on github][source]¶ Generate absolute path to modified
fname
.Parameters: - fname (str) – Name of file, with or without an extension.
- ext (str, optional) – File extension to append to
fname
. Ifext
is None, thenfname
is analyzed to see if it likely already has an extension. An extension is set to the last element in the list of strings returned byfname.split('.')
if this list has more than 1 element. Otherwise,ext
will be set to an empty string''
. Ifext
is not None and is a valid string, thenfname
is analyzed to see if it already ends withext
. Iffname.endswith(ext)
isTrue
from the start, thenext
will not be duplicately appended. - outpath (str, optional) – Absolute or relative path for generated output file.
Default is the absolute path returned by
os.getcwd()
. - overwrite (bool, optional) – If
True
, overwrite an existing file if it has the same generated file path. - add_fnum (bool, optional) – Append integer number to output file name, starting with 1.
- fnum ({None, int}, optional) –
Starting file number to append if
add_fnum
isTrue
.If the generated file path exists and
overwrite
is False, setting this parameter has no effect. - include_fname (bool, optional) – If
True
, return(fpath, fname)
tuple. - fname_only (bool, optional) – If
True
, return onlyfname
. - verbose (bool, optional) – Show verbose output.
Returns: