Compare commits
3 commits
afc163f344
...
8f1e3668a3
Author | SHA1 | Date | |
---|---|---|---|
8f1e3668a3 | |||
a6c0614979 | |||
2cabe6a3ba |
3 changed files with 13 additions and 3 deletions
|
@ -79,7 +79,7 @@ auto MassManager::importMass(const std::string& staged_fn, int hangar) -> bool {
|
||||||
std::string source = Utility::Directory::join(_stagingAreaDirectory, staged_fn);
|
std::string source = Utility::Directory::join(_stagingAreaDirectory, staged_fn);
|
||||||
Utility::Directory::copy(source, source + ".tmp");
|
Utility::Directory::copy(source, source + ".tmp");
|
||||||
|
|
||||||
if(!Mass{source + ".tmp"}.updateSteamId(_steamId))
|
if(!Mass{source + ".tmp"}.updateAccount(_steamId))
|
||||||
{
|
{
|
||||||
_lastError = "The M.A.S.S. file at " + source + " seems to be corrupt.";
|
_lastError = "The M.A.S.S. file at " + source + " seems to be corrupt.";
|
||||||
Utility::Directory::rm(source + ".tmp");
|
Utility::Directory::rm(source + ".tmp");
|
||||||
|
|
|
@ -102,7 +102,7 @@ auto BinaryWriter::writeDouble(Double value) -> bool {
|
||||||
return std::fwrite(&value, sizeof(Double), 1, _file) == 1;
|
return std::fwrite(&value, sizeof(Double), 1, _file) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto BinaryWriter::writeArray(Containers::ArrayView<char> array) -> bool {
|
auto BinaryWriter::writeArray(Containers::ArrayView<const char> array) -> bool {
|
||||||
if(array.size() == 0) {
|
if(array.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,12 @@ class BinaryWriter {
|
||||||
explicit BinaryWriter(const std::string& filename);
|
explicit BinaryWriter(const std::string& filename);
|
||||||
~BinaryWriter();
|
~BinaryWriter();
|
||||||
|
|
||||||
|
BinaryWriter(const BinaryWriter& other) = delete;
|
||||||
|
BinaryWriter& operator=(const BinaryWriter& other) = delete;
|
||||||
|
|
||||||
|
BinaryWriter(BinaryWriter&& other) = default;
|
||||||
|
BinaryWriter& operator=(BinaryWriter&& other) = default;
|
||||||
|
|
||||||
auto open() -> bool;
|
auto open() -> bool;
|
||||||
|
|
||||||
void closeFile();
|
void closeFile();
|
||||||
|
@ -53,7 +59,11 @@ class BinaryWriter {
|
||||||
auto writeUnsignedLong(UnsignedLong value) -> bool;
|
auto writeUnsignedLong(UnsignedLong value) -> bool;
|
||||||
auto writeFloat(Float value) -> bool;
|
auto writeFloat(Float value) -> bool;
|
||||||
auto writeDouble(Double value) -> bool;
|
auto writeDouble(Double value) -> bool;
|
||||||
auto writeArray(Containers::ArrayView<char> array) -> bool;
|
auto writeArray(Containers::ArrayView<const char> array) -> bool;
|
||||||
|
template<std::size_t size>
|
||||||
|
auto writeString(const char(&str)[size]) -> bool {
|
||||||
|
return writeArray({str, size - 1});
|
||||||
|
}
|
||||||
|
|
||||||
template<std::size_t S>
|
template<std::size_t S>
|
||||||
auto writeStaticArray(Containers::StaticArrayView<S, const char> array) -> bool {
|
auto writeStaticArray(Containers::StaticArrayView<S, const char> array) -> bool {
|
||||||
|
|
Loading…
Reference in a new issue