Skip to content

Commit

Permalink
go back to simpler save code
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbern committed Dec 5, 2018
1 parent f71ce50 commit bbaac16
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/annoylib.h
Original file line number Diff line number Diff line change
Expand Up @@ -833,10 +833,7 @@ template<typename S, typename T, typename Distance, typename Random>

bool save(const char* filename, bool prefault=false) {
// Delete file if it already exists (See issue #335)
struct stat buffer;
if (stat(filename, &buffer) == 0)
if (unlink(filename) != 0)
return false;
unlink(filename);

FILE *f = fopen(filename, "wb");
if (f == NULL)
Expand Down

0 comments on commit bbaac16

Please sign in to comment.