Skip to content

Commit 235e59b

Browse files
committed
More refactor file manipulations to use pathlib
1 parent 6d90fe5 commit 235e59b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/axelrod_fortran/shared_library_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
def load_library(filename):
1515
"""Loads a shared library."""
1616
lib = None
17-
if os.path.exists(filename):
17+
if Path(filename).exists():
1818
lib = cdll.LoadLibrary(filename)
1919
return lib
2020

@@ -64,7 +64,7 @@ def create_library_copy(self):
6464
self.prefix,
6565
str(copy_number),
6666
self.shared_library_name)
67-
new_filename = str(Path(temp_directory) / filename)
67+
new_filename = str(Path(temp_directory, filename))
6868
if self.verbose:
6969
print("Loading {}".format(new_filename))
7070
shutil.copy2(self.library_path, new_filename)
@@ -110,7 +110,7 @@ def __del__(self):
110110
if path.exists():
111111
if self.verbose:
112112
print("deleting", str(path))
113-
os.remove(str(path))
113+
path.unlink()
114114

115115

116116
# Setup up thread safe library manager.

0 commit comments

Comments
 (0)