From 6a32424fb2a8435ed848aaf1ca66e3e100e5af46 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Sat, 4 May 2013 09:41:10 -0700 Subject: [PATCH] make readFromFileV2() return bool for file exists --- libraries/voxels/src/VoxelTree.cpp | 4 +++- libraries/voxels/src/VoxelTree.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/voxels/src/VoxelTree.cpp b/libraries/voxels/src/VoxelTree.cpp index 05473ef711..26803272d7 100644 --- a/libraries/voxels/src/VoxelTree.cpp +++ b/libraries/voxels/src/VoxelTree.cpp @@ -865,7 +865,7 @@ int VoxelTree::encodeTreeBitstreamRecursion(int maxEncodeLevel, int& currentEnco return bytesAtThisLevel; } -void VoxelTree::readFromFileV2(const char* fileName, bool reset) { +bool VoxelTree::readFromFileV2(const char* fileName) { std::ifstream file(fileName, std::ios::in|std::ios::binary|std::ios::ate); if(file.is_open()) { printLog("loading file...\n"); @@ -881,7 +881,9 @@ void VoxelTree::readFromFileV2(const char* fileName, bool reset) { delete[] entireFile; file.close(); + return true; } + return false; } void VoxelTree::writeToFileV2(const char* fileName) const { diff --git a/libraries/voxels/src/VoxelTree.h b/libraries/voxels/src/VoxelTree.h index 3eb53309a5..7bd7ed5125 100644 --- a/libraries/voxels/src/VoxelTree.h +++ b/libraries/voxels/src/VoxelTree.h @@ -67,7 +67,7 @@ public: // these will read/write files that match the wireformat, excluding the 'V' leading void writeToFileV2(const char* filename) const; - void readFromFileV2(const char* filename, bool reset); + bool readFromFileV2(const char* filename); private: int encodeTreeBitstreamRecursion(int maxEncodeLevel, int& currentEncodeLevel,