Skip to content

Commit

Permalink
don't warn for non exist at create_directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Daniel committed Jun 4, 2023
1 parent 4eacbd3 commit d33a55a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/save_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void GetSaveFileNameForSlot(

void CreateSlotSavesDir()
{
if(!create_directory( SAVES_DIR ))
if(!create_directory( SAVES_DIR ) && errno != 17)
Log::Warning("Couldn't create saves directory: ", strerror(errno));
}

Expand Down
7 changes: 4 additions & 3 deletions src/system_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,9 +865,10 @@ bool SystemWindow::ScreenShot( const std::string& file ) const
for (auto & p : pixels)
p = { (uint8_t)(r[p[0]] >> 8), (uint8_t)(g[p[1]] >> 8), (uint8_t)(b[p[2]] >> 8), p[3] };

/* create target directory */
if(!create_directory(dir_name<std::string>(file)))
Log::Warning("Couldn't create screenshot directory: ", strerror(errno));
/* create target directory if path dir is not file path */
if(dir_name<std::string>(file) != base_name<std::string>(file))
if(!create_directory(dir_name<std::string>(file)) && errno != 17)
Log::Warning("Couldn't create screenshot directory: ", dir_name<std::string>(file), base_name<std::string>(file), strerror(errno));

ChasmReverse::WriteTGA(screen->w, screen->h, &pixels.front().front(), nullptr, (remove_extension<std::string>(file) + ".tga").c_str());

Expand Down

0 comments on commit d33a55a

Please sign in to comment.