From 40fa3b7ccc09a1478f2ed78e9aacdfa509329f20 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Sun, 18 Jul 2010 17:43:02 -0500 Subject: [PATCH] change screenshot naming from screen##### to YYYY-MM-DD_HHMMSS, thus fixing the bug where multiple screen00000 shots were being made. --- Docs/Changelog_sm-ssc.txt | 6 ++++++ src/StepMania.cpp | 19 +++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Docs/Changelog_sm-ssc.txt b/Docs/Changelog_sm-ssc.txt index 40399a82d8..dbfbb7ed6d 100644 --- a/Docs/Changelog_sm-ssc.txt +++ b/Docs/Changelog_sm-ssc.txt @@ -14,6 +14,12 @@ sm-ssc v1.0 Release Candidate 2 | 201007xx -------------------------------------------------------------------------------- (work in progress, it's not out yet [hence the "xx" above].) +20100718 +-------- +* Change screenshot naming format from "screen#####" to "YYYY-MM-DD_HHMMSS". + This should solve an issue where screen00000 was getting written multiple + times for unknown reasons. + 20100717 -------- sm4svn: diff --git a/src/StepMania.cpp b/src/StepMania.cpp index 4fddeb013a..08203dc8f7 100644 --- a/src/StepMania.cpp +++ b/src/StepMania.cpp @@ -1229,16 +1229,15 @@ int main(int argc, char* argv[]) RString StepMania::SaveScreenshot( RString sDir, bool bSaveCompressed, bool bMakeSignature, int iIndex ) { - /* Files should be of the form "screen#####.xxx". Ignore the extension; find - * the last file of this form, and use the next number. This way, we don't - * write the same screenshot number for different formats (screen00011.bmp, - * screen00011.jpg), and we always increase from the end, so if screen00003.jpg - * is deleted, we won't fill in the hole (which makes screenshots hard to find). */ - RString sFileNameNoExtension; - if( iIndex == -1 ) - sFileNameNoExtension = Profile::MakeUniqueFileNameNoExtension( sDir, "screen" ); - else - sFileNameNoExtension = Profile::MakeFileNameNoExtension( "screen", iIndex ); + /* As of sm-ssc v1.0 rc2, screenshots are no longer named by an arbitrary + * index. This was causing naming issues for some unknown reason, so we have + * changed the screenshot names to a non-blocking format: date and time. + * As before, we ignore the extension. -aj */ + RString sFileNameNoExtension = DateTime::GetNowDateTime().GetString(); + // replace space with underscore. + sFileNameNoExtension.Replace(" ","_"); + // colons are illegal in filenames. + sFileNameNoExtension.Replace(":",""); // Save the screenshot. If writing lossy to a memcard, use // SAVE_LOSSY_LOW_QUAL, so we don't eat up lots of space.