Skip to content

Commit

Permalink
Merge pull request #480 from agateau/change-screenshots-dir
Browse files Browse the repository at this point in the history
Store screenshots in a "screenshots" sub-directory
  • Loading branch information
agateau authored Jan 22, 2025
2 parents 6192c42 + ab603ea commit 28065f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/Changed-20250117-192541.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Changed
body: Screenshots are now stored in a "screenshots" subdirectory of the local config directory.
time: 2025-01-17T19:25:41.340109991+01:00
8 changes: 6 additions & 2 deletions core/src/com/agateau/utils/ScreenshotCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.PixmapIO;
import com.badlogic.gdx.utils.GdxRuntimeException;
import java.io.File;
import java.io.IOException;
import java.util.Calendar;
import java.util.Locale;
Expand Down Expand Up @@ -70,7 +71,10 @@ private static void init() {

private static FileHandle generateFileHandle() {
Calendar calendar = Calendar.getInstance(TimeZone.getDefault());
String filename = String.format(Locale.US, FILENAME_FORMAT, calendar);
return FileUtils.getUserWritableFile(filename);
String path =
"screenshots"
+ File.separator
+ String.format(Locale.US, FILENAME_FORMAT, calendar);
return FileUtils.getUserWritableFile(path);
}
}

0 comments on commit 28065f5

Please sign in to comment.