Use workaround for GCC Bug 66145
This commit is contained in:
parent
66fc779d33
commit
c19c2c570f
13
main.cpp
13
main.cpp
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <c++utilities/application/argumentparser.h>
|
#include <c++utilities/application/argumentparser.h>
|
||||||
#include <c++utilities/application/failure.h>
|
#include <c++utilities/application/failure.h>
|
||||||
|
#include <c++utilities/io/catchiofailure.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -204,7 +205,7 @@ vector<Location> locationsFromFile(const string &path)
|
||||||
fstream file;
|
fstream file;
|
||||||
file.open(path, ios_base::in);
|
file.open(path, ios_base::in);
|
||||||
if(!file)
|
if(!file)
|
||||||
throw ios_base::failure("Unable to open the file \"" + path + "\".");
|
IoUtilities::throwIoFailure(("Unable to open the file \"" + path + "\".").data());
|
||||||
file.exceptions(ios_base::badbit);
|
file.exceptions(ios_base::badbit);
|
||||||
string line;
|
string line;
|
||||||
vector<Location> locations;
|
vector<Location> locations;
|
||||||
|
@ -259,8 +260,9 @@ void printTrackLength(const string &filePath, bool circle)
|
||||||
vector<Location> locations(locationsFromFile(filePath));
|
vector<Location> locations(locationsFromFile(filePath));
|
||||||
printDistance(Location::trackLength(locations, circle));
|
printDistance(Location::trackLength(locations, circle));
|
||||||
cout << " (" << locations.size() << " trackpoints)";
|
cout << " (" << locations.size() << " trackpoints)";
|
||||||
} catch(ios_base::failure &ex) {
|
} catch(...) {
|
||||||
cout << "An IO failure occured when reading file from provided path: " << ex.what() << endl;
|
const char *what = ::IoUtilities::catchIoFailure();
|
||||||
|
cout << "An IO failure occured when reading file from provided path: " << what << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,7 +330,8 @@ void printMapsLink(const string &filePath)
|
||||||
} else {
|
} else {
|
||||||
throw Failure("At least one location is required to generate a link.");
|
throw Failure("At least one location is required to generate a link.");
|
||||||
}
|
}
|
||||||
} catch(ios_base::failure &ex) {
|
} catch(...) {
|
||||||
cout << "An IO failure occured when reading file from provided path: " << ex.what() << endl;
|
const char *what = ::IoUtilities::catchIoFailure();
|
||||||
|
cout << "An IO failure occured when reading file from provided path: " << what << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue