88# See https://mit-license.org/ and LICENSE.md and for license information.
99# =================================================================================================
1010
11- import os
11+ import pathlib
1212
1313from pylith .utils .PetscComponent import PetscComponent
1414
@@ -29,23 +29,21 @@ def preinitialize(self):
2929 self ._createModuleObj ()
3030
3131 @staticmethod
32- def mkfilename (outputDir , simName , label , suffix ):
32+ def makeFilename (outputDir , simName , label , suffix ):
3333 """Create filename from output directory, simulation name, label, and filename suffix.
3434 """
35- filename = os .path .join (outputDir , "{}-{}.{}" .format (simName , label , suffix ))
36- return filename
35+ return pathlib .Path (outputDir ) / f"{ simName } -{ label } .{ suffix } "
3736
38- def mkpath (self , filename ):
37+ def makePath (self , filename ):
3938 """Create path for output file.
4039 """
4140 from pylith .mpi .Communicator import mpi_is_root
4241 isRoot = mpi_is_root ()
4342 if isRoot :
4443 self ._info .log ("Creating path for output file '{}'" .format (filename ))
45- relpath = os .path .dirname (filename )
46-
47- if relpath and not os .path .exists (relpath ) and isRoot :
48- os .makedirs (relpath )
44+ relpath = pathlib .Path (filename ).parent .resolve ()
45+ if isRoot :
46+ relpath .mkdir (exist_ok = True , parents = True )
4947
5048 def verifyConfiguration (self ):
5149 """Verify compatibility of configuration.
0 commit comments