aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/picmi.py
diff options
context:
space:
mode:
authorGravatar Andrew Myers <atmyers@lbl.gov> 2021-10-18 16:10:54 -0700
committerGravatar GitHub <noreply@github.com> 2021-10-18 16:10:54 -0700
commit08509a57218470c1057b49268c47e0c562782328 (patch)
tree581c19a743fbd47fd2a1262fde2ccc97b7064d42 /Python/pywarpx/picmi.py
parent5072a563b7a355b539fdf67a72cc1a111d0b7615 (diff)
downloadWarpX-08509a57218470c1057b49268c47e0c562782328.tar.gz
WarpX-08509a57218470c1057b49268c47e0c562782328.tar.zst
WarpX-08509a57218470c1057b49268c47e0c562782328.zip
Use os.path.join in picmi.py for portability (#2400)
* Use os.path.join in picmi.py for portability * Apply suggestions from code review
Diffstat (limited to 'Python/pywarpx/picmi.py')
-rw-r--r--Python/pywarpx/picmi.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py
index 374cbc962..1b55055b6 100644
--- a/Python/pywarpx/picmi.py
+++ b/Python/pywarpx/picmi.py
@@ -9,6 +9,7 @@
"""Classes following the PICMI standard
"""
import re
+import os
import picmistandard
import numpy as np
import pywarpx
@@ -1052,7 +1053,7 @@ class FieldDiagnostic(picmistandard.PICMI_FieldDiagnostic):
if self.write_dir is not None or self.file_prefix is not None:
write_dir = (self.write_dir or 'diags')
file_prefix = (self.file_prefix or self.name)
- self.diagnostic.file_prefix = write_dir + '/' + file_prefix
+ self.diagnostic.file_prefix = os.path.join(write_dir, file_prefix)
ElectrostaticFieldDiagnostic = FieldDiagnostic
@@ -1087,7 +1088,7 @@ class Checkpoint(picmistandard.base._ClassWithInit):
if self.write_dir is not None or self.file_prefix is not None:
write_dir = (self.write_dir or 'diags')
file_prefix = (self.file_prefix or self.name)
- self.diagnostic.file_prefix = write_dir + '/' + file_prefix
+ self.diagnostic.file_prefix = os.path.join(write_dir, file_prefix)
class ParticleDiagnostic(picmistandard.PICMI_ParticleDiagnostic):
def init(self, kw):
@@ -1131,7 +1132,7 @@ class ParticleDiagnostic(picmistandard.PICMI_ParticleDiagnostic):
if self.write_dir is not None or self.file_prefix is not None:
write_dir = (self.write_dir or 'diags')
file_prefix = (self.file_prefix or self.name)
- self.diagnostic.file_prefix = write_dir + '/' + file_prefix
+ self.diagnostic.file_prefix = os.path.join(write_dir, file_prefix)
# --- Use a set to ensure that fields don't get repeated.
variables = set()
@@ -1283,7 +1284,7 @@ class LabFrameFieldDiagnostic(picmistandard.PICMI_LabFrameFieldDiagnostic):
if self.write_dir is not None or self.file_prefix is not None:
write_dir = (self.write_dir or 'diags')
file_prefix = (self.file_prefix or self.name)
- self.diagnostic.file_prefix = write_dir + '/' + file_prefix
+ self.diagnostic.file_prefix = os.path.join(write_dir, file_prefix)
class LabFrameParticleDiagnostic(picmistandard.PICMI_LabFrameParticleDiagnostic):