File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -42,18 +42,10 @@ class TomlHarvestPlugin(HermesHarvestPlugin):
4242 def __call__ (self , command : HermesHarvestCommand ):
4343 """start of the process of harvesting the .toml file"""
4444
45- #set the working directory to the correct location
46- path = command .args .path
47- old_path = pathlib .Path .cwd ()
48- if path != old_path :
49- chdir (path )
50-
51- #harvesting the data from the .toml file specified in the Settings class
52- data = self .read_from_toml (command .settings .toml .filename )
53-
54- #resetting the working directory
55- if path != old_path :
56- chdir (old_path )
45+ #set the working directory temporary to the correct location
46+ with chdir (command .args .path ):
47+ #harvesting the data from the .toml file specified in the Settings class
48+ data = self .read_from_toml (command .settings .toml .filename )
5749
5850 #returning the harvested data and some metadata
5951 return data , {"filename" : command .settings .toml .filename }
You can’t perform that action at this time.
0 commit comments