Skip to content

Commit

Permalink
win32: create screenshots path if needed. Fall back to Pictures folder
Browse files Browse the repository at this point in the history
Ask Windows to create the Screenshots folder if it doesn't exist.
Fall back to Pictures folder if the Screenshots folder can't be
determined.
Issue #1761
  • Loading branch information
flyinghead committed Nov 30, 2024
1 parent d38ce47 commit b91f82c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/oslib/oslib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ void saveScreenshot(const std::string& name, const std::vector<u8>& data)
static std::string getScreenshotsPath()
{
wchar_t *screenshotPath;
if (FAILED(SHGetKnownFolderPath(FOLDERID_Screenshots, KF_FLAG_DEFAULT, NULL, &screenshotPath)))
if (FAILED(SHGetKnownFolderPath(FOLDERID_Screenshots, KF_FLAG_CREATE, NULL, &screenshotPath))
&& FAILED(SHGetKnownFolderPath(FOLDERID_Pictures, KF_FLAG_CREATE, NULL, &screenshotPath)))
return get_writable_config_path("");
nowide::stackstring path;
std::string ret;
Expand Down

0 comments on commit b91f82c

Please sign in to comment.