Skip to content

Commit b21fc05

Browse files
committed
Use the descriptive function name
1 parent e870437 commit b21fc05

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

src/io.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,11 @@ void IO::showBanner() const
238238

239239
std::map<std::string, std::string> IO::readOptionFile(const std::string& inputFilename) const
240240
{
241-
std::ifstream infile(inputFilename, std::ios::binary);
242-
243241
fmt::print("Reading {} for the input values {{--", inputFilename);
244242
std::map<std::string, std::string> inputfile_options;
245-
if (!infile)
243+
244+
std::ifstream infile(inputFilename, std::ios::binary);
245+
if (!infile.is_open())
246246
{
247247
fmt::print("\n***ERROR***: {} couldn't be opened, does it exist?\n", inputFilename);
248248

src/massTable.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ bool MassTable::readAME(const std::filesystem::path& ameTable) const
5959

6060
std::ifstream file(ameTable, std::ios::binary);
6161

62-
if (!file)
62+
if (!file.is_open())
6363
{
6464
fmt::print("\n***ERROR***: {} couldn't be opened, does it exist?\n\n", ameTable);
6565
return false;
@@ -121,7 +121,7 @@ bool MassTable::readNUBASE(const std::filesystem::path& nubaseTable)
121121
fmt::print("Reading {} for nuclear values <--", nubaseTable);
122122
std::ifstream file(nubaseTable, std::ios::binary);
123123

124-
if (!file)
124+
if (!file.is_open())
125125
{
126126
fmt::print("\n***ERROR***: {} couldn't be opened, does it exist?\n\n", nubaseTable);
127127
return false;
@@ -196,7 +196,7 @@ bool MassTable::readOWN(const std::filesystem::path& ownTable) const
196196
fmt::print("Reading {} for user selected nuclei (--", ownTable);
197197
std::ifstream inFile(ownTable, std::ios::binary);
198198

199-
if (!inFile)
199+
if (!inFile.is_open())
200200
{
201201
fmt::print("\n***ERROR***: {} couldn't be opened\n\n", ownTable);
202202
return false;
@@ -328,6 +328,12 @@ bool MassTable::outputTableToCSV() const
328328
fmt::print("New file: {}\n", outfile);
329329
std::ofstream out(outfile);
330330

331+
if (!out.is_open())
332+
{
333+
fmt::print("\n***ERROR***: {} couldn't be opened", outfile);
334+
return false;
335+
}
336+
331337
const Nuclide header("foobar");
332338
fmt::print(out, "{}\n", header.CSVHeader());
333339
for (const auto& isotope : theTable)

src/options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ void Options::writeOptionFile() const
242242

243243
fmt::print("Writing user choices to {}", options);
244244

245-
if (!opts)
245+
if (!opts.is_open())
246246
{
247247
fmt::print("\n***ERROR***: Couldn't open {} to write the options\n"
248248
" Not creating an option file.\n",

src/rProcess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ bool rProcess::readData() const
2020

2121
std::ifstream rp(theFile, std::ios::binary);
2222

23-
if (!rp)
23+
if (!rp.is_open())
2424
{
2525
fmt::print(stderr, "***ERROR***: {} couldn't be opened to read the r-process path\n", file);
2626
return false;

0 commit comments

Comments
 (0)