-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add scripts to remove the JSON persistent storage.
- Loading branch information
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| @echo off | ||
| REM delete-storage.bat | ||
| REM Deletes the Millions JSON storage for resetting app state | ||
| REM The storage file location is chosen by StorageFile.java | ||
|
|
||
| SET "STORAGE_FOLDER_NAME=Millions" | ||
| SET "STORAGE_FILE=storage.json" | ||
|
|
||
| REM Use %APPDATA% if set, otherwise fallback to %USERPROFILE% | ||
| IF DEFINED APPDATA ( | ||
| SET "STORAGE_DIR=%APPDATA%\%STORAGE_FOLDER_NAME%" | ||
| ) ELSE ( | ||
| SET "STORAGE_DIR=%USERPROFILE%\%STORAGE_FOLDER_NAME%" | ||
| ) | ||
|
|
||
| SET "STORAGE_PATH=%STORAGE_DIR%\%STORAGE_FILE%" | ||
|
|
||
| IF EXIST "%STORAGE_PATH%" ( | ||
| ECHO Deleting storage at %STORAGE_PATH% ... | ||
| DEL /F "%STORAGE_PATH%" | ||
| ECHO Storage deleted. | ||
| ) ELSE ( | ||
| ECHO Storage not found at %STORAGE_PATH%. | ||
| ) | ||
|
|
||
| PAUSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/usr/bin/env bash | ||
| # delete-storage.sh | ||
| # Deletes the Millions JSON storage for resetting app state | ||
| # The storage file location is chosen by StorageFile.java | ||
|
|
||
| set -e | ||
|
|
||
| STORAGE_FOLDER_NAME="Millions" | ||
| STORAGE_FILE="storage.json" | ||
|
|
||
| OS=$(uname | tr '[:upper:]' '[:lower:]') | ||
| HOME_DIR="$HOME" | ||
|
|
||
| # Determine database folder path based on OS | ||
| if [[ "$OS" == *"darwin"* ]]; then | ||
| # macOS | ||
| STORAGE_DIR="$HOME_DIR/Library/Application Support/$STORAGE_FOLDER_NAME" | ||
| elif [[ "$OS" == *"linux"* ]]; then | ||
| # Linux / Unix | ||
| STORAGE_DIR="$HOME_DIR/.local/share/$STORAGE_FOLDER_NAME" | ||
| elif [[ "$OS" == *"mingw"* || "$OS" == *"cygwin"* || "$OS" == *"msys"* ]]; then | ||
| # Windows (Git Bash, Cygwin, MSYS) | ||
| if [[ -n "$APPDATA" ]]; then | ||
| STORAGE_DIR="$APPDATA/$STORAGE_FOLDER_NAME" | ||
| else | ||
| STORAGE_DIR="$HOME_DIR/$STORAGE_FOLDER_NAME" | ||
| fi | ||
| else | ||
| echo "Unsupported OS: $OS" | ||
| exit 1 | ||
| fi | ||
|
|
||
| STORAGE_PATH="$STORAGE_DIR/$STORAGE_FILE" | ||
|
|
||
| if [[ -f "$STORAGE_PATH" ]]; then | ||
| echo "Deleting storage at $STORAGE_PATH ..." | ||
| rm "$STORAGE_PATH" | ||
| echo "Storage deleted." | ||
| else | ||
| echo "Storage not found at $STORAGE_PATH" | ||
| fi | ||
|
|