![]() |
ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation. |
Generate and return a unique (directory or file) path name in the temporary directory of the system or if there is none, in the current working directory of the program, optionally with the user-specified file name segments.
More...
Generate and return a unique (directory or file) path name in the temporary directory of the system or if there is none, in the current working directory of the program, optionally with the user-specified file name segments.
The procedures under this generic interface return a full unique path that is,
prefix
,ext
, that can be either.*
, if a file path is desired as the output, orThe procedures under this generic interface use the current date and time and the process ID to generate new unique non-existing directory or file paths.
The general format of the output directory path is the following:
<tempdir><prefix><ccyymmdd><sep><hhmmss><sep><sss><sep>pid<sep><pid><ext>
where,
<tempdir>
is replaced with the operating system temporary directory or if none is detected, with the current runtime working directory, <prefix>
is replaced with the contents of the input argument prefix
or its default value, <sep>
is replaced with the contents of the input argument sep
or its default value, <ccyymmdd>
is replaced with the current century, year, month, and day, each represented by two characters, <hhmmss>
is replaced with the current hour hh
, minute mm
, second ss
, in the specified ordered, <sss>
is replaced with the current millisecond mmm
, <pid>
is replaced with the user-specified processor ID pid
which can be the output of getImageID.<ext>
is replaced with the contents of the input argument ext
or its default value.If no unique path is found after 1000
attempts, the procedure returns and reports a failure.
[in] | prefix | : The input scalar character of default kind SK containing the requested input prefix to the path that appears first in the newly-constructed path.(optional, default = "new"//sep where sep is the other optional argument of the interface.) |
[in] | sep | : The input scalar character of default kind SK containing the requested separator character to be inserted between the individual components of the new path to be constructed.This is different from the system shell directory separator. (optional, default = "_" ) |
[in] | ext | : The input scalar character of default kind SK containing the requested input file extension or directory path-separator to appear at the end of the path.(optional, default = "" ) |
[in] | pid | : The input scalar integer of default kind IK representing the processor ID (e.g., processor MPI rank or Coarray image ID).If present, it will be used in the generated path to make it processor-specific. The processor MPI rank or Coarray image ID can be for example obtained by calling getImageID. (optional, default = getImageID()) |
[out] | failed | : The output logical of default kind LK that is .true. if and only if the procedure fails to find a new unique (non-existent) path.(optional, if missing and the procedure fails, then the program will halt by calling error stop .) |
pathTemp
: The output allocatable
scalar of type character
of default kind SK, containing a new unique non-existent temporary (directory or file) path, either in the OS temporary directory or in the current working directory.
Possible calling interfaces ⛓
ext
argument, if it is present and contains a file extension, must the proper file extension separator symbol (e.g., .
)..
) will not be added to the input extension by this procedure.impure
.
Example usage ⛓
ifort
compiler ⛓ ifort
compiler ⛓ gfortran
compiler ⛓ character
kinds leads to compile-time kind mismatch errors.suffix
argument can be added in the future. Currently, the path suffix is hard-coded in the procedure, unlike prefix
.
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
Definition at line 4498 of file pm_sysPath.F90.