Skip to content

Commit aec64dd

Browse files
committed
Renamed CwdChanger::reset to CwdChanger::restore and CwdChanger::release to CwdChanger::stay
1 parent d0fcbfd commit aec64dd

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

OpenSim/Common/IO.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,12 +736,12 @@ IO::CwdChanger& IO::CwdChanger::operator=(CwdChanger&& tmp) {
736736
return *this;
737737
}
738738

739-
void IO::CwdChanger::reset() {
739+
void IO::CwdChanger::restore() {
740740
chDir(_existingDir);
741741
_existingDir.clear();
742742
}
743743

744-
void IO::CwdChanger::release() noexcept {
744+
void IO::CwdChanger::stay() noexcept {
745745
_existingDir.clear();
746746
}
747747

OpenSim/Common/IO.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,18 @@ class OSIMCOMMON_API IO {
191191
* original location.
192192
*
193193
* This is functionally equivalent to prematurely destructing the
194-
* CwdChanger. After calling CwdChanger::reset(), the now-reset
194+
* CwdChanger. After calling CwdChanger::restore(), the now-restored
195195
* CwdChanger will become a noop instance that, when it destructs,
196196
* will not attempt to change back to the original directory.
197197
*/
198-
void reset();
198+
void restore();
199199

200200
/**
201201
* Release CwdChanger's control over the current working directory,
202-
* such that the CwdChanger instance does not attempt to change
203-
* directory on destruction.
202+
* such that the CwdChanger instance does not attempt to change back
203+
* to its original directory on destruction.
204204
*/
205-
void release() noexcept;
205+
void stay() noexcept;
206206

207207
/**
208208
* Destructs a CwdChanger instance.

OpenSim/Simulation/Model/ExternalLoads.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ void ExternalLoads::extendConnectToModel(Model& aModel)
166166
log_error("Failed to read ExternalLoads data file '{}'.",
167167
this->_dataFileName);
168168
if (this->getDocument()) {
169-
cwd.reset();
169+
cwd.restore();
170170
} else {
171-
cwd.release();
171+
cwd.stay();
172172
}
173173
throw(ex);
174174
}

OpenSim/Tools/AnalyzeTool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ bool AnalyzeTool::run(bool plotting)
603603
if (completed && _printResultFiles)
604604
printResults(getName(),getResultsDir()); // this will create results directory if necessary
605605

606-
cwd.reset();
606+
cwd.restore();
607607

608608
removeExternalLoadsFromModel();
609609

OpenSim/Tools/ForwardTool.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,18 +309,18 @@ bool ForwardTool::run()
309309
} catch(const std::exception& x) {
310310
log_error("ForwardTool::run() caught an exception: \n {}", x.what());
311311
completed = false;
312-
cwd.reset();
312+
cwd.restore();
313313
}
314314
catch (...) { // e.g. may get InterruptedException
315315
log_error("ForwardTool::run() caught an exception.");
316316
completed = false;
317-
cwd.reset();
317+
cwd.restore();
318318
}
319319
// PRINT RESULTS
320320
string fileName;
321321
if(_printResultFiles) printResultsInternal();
322322

323-
cwd.reset();
323+
cwd.restore();
324324

325325
removeAnalysisSetFromModel();
326326
return completed;

OpenSim/Tools/InverseDynamicsTool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ bool InverseDynamicsTool::run()
407407

408408
IO::makeDir(getResultsDir());
409409
Storage::printResult(&genForceResults, _outputGenForceFileName, getResultsDir(), -1, ".sto");
410-
cwd.reset();
410+
cwd.restore();
411411

412412
// if body forces to be reported for specified joints
413413
if(nj >0){

OpenSim/Tools/RRATool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,14 +817,14 @@ bool RRATool::run()
817817
catch(const Exception& x) {
818818
// TODO: eventually might want to allow writing of partial results
819819
log_error(x.what());
820-
cwd.reset();
820+
cwd.restore();
821821
// close open files if we die prematurely (e.g. Opt fail)
822822
manager.getStateStorage().print(getResultsDir() + "/" + getName() + "_states.sto");
823823
return false;
824824
}
825825
catch(...) {
826826
// TODO: eventually might want to allow writing of partial results
827-
cwd.reset();
827+
cwd.restore();
828828
// close open files if we die prematurely (e.g. Opt fail)
829829
manager.getStateStorage().print(getResultsDir() + "/" + getName() + "_states.sto");
830830
return false;

0 commit comments

Comments
 (0)