|
@@ -18,15 +18,17 @@ bool FileManager::openPutFile(const std::string &filename) {
|
|
|
this->putFileName = this->fileDirectory;
|
|
|
this->putFileName.append(filename);
|
|
|
|
|
|
- // open file and test if it already exists
|
|
|
- this->putFile.open(this->putFileName, std::ios::app | std::ios::binary);
|
|
|
- if (this->putFile.tellp() != std::ios::beg) {
|
|
|
- // file already exists
|
|
|
+ std::ifstream ifile(this->putFileName);
|
|
|
+ if (ifile.is_open()) {
|
|
|
+ // file alread exists
|
|
|
+ ifile.close();
|
|
|
closePutFile();
|
|
|
return false;
|
|
|
- } else {
|
|
|
- return true;
|
|
|
}
|
|
|
+
|
|
|
+ // open file and test if it already exists
|
|
|
+ this->putFile.open(this->putFileName, std::ios::app | std::ios::binary);
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
bool FileManager::openGetFile(const std::string &filename, int &chunks) {
|