Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3
2j @ s, d Z ddlZddlZejdZdddZdS )zHCollection of utilities for command-line interfaces and console scripts. Nz#\d+$Fc C s t jj| \}}t jj|\}}|r(|}tj|d }|dkrNt jj| d }t jj||| }d}|sx6t jj|rt jj||d t| | }|d7 }qjW |S )a Generates a suitable file name for writing output.
Often tools will want to take a file, do some kind of transformation to it,
and write it out again. This function determines an appropriate name for the
output file, through one or more of the following steps:
- changing the output directory
- replacing the file extension
- suffixing the filename with a number (``#1``, ``#2``, etc.) to avoid
overwriting an existing file.
Args:
input: Name of input file.
outputDir: Optionally, a new directory to write the file into.
extension: Optionally, a replacement for the current file extension.
overWrite: Overwriting an existing file is permitted if true; if false
and the proposed filename exists, a new name will be generated by
adding an appropriate number suffix.
Returns:
str: Suitable output filename
r N #)ospathsplitsplitext
numberAddedREjoinexistsrepr) inputZ outputDir extensionZ overWritedirNamefileNameextoutputn r