diff --git a/Find-SaveData.ps1 b/Find-SaveData.ps1 new file mode 100644 index 0000000..fc7b4d5 --- /dev/null +++ b/Find-SaveData.ps1 @@ -0,0 +1,18 @@ +& { + $saves = Join-Path $env:USERPROFILE 'AppData\LocalLow\Endnight\SonsOfTheForest\Saves' + if (-not (Test-Path -LiteralPath $saves)) { + Write-Host "Sons of the Forest saves folder not found: $saves" -ForegroundColor Red + return + } + $latest = Get-ChildItem -LiteralPath $saves -Filter 'SaveData.zip' -File -Recurse -ErrorAction SilentlyContinue | + Sort-Object LastWriteTime -Descending | + Select-Object -First 1 + if (-not $latest) { + Write-Host "No SaveData.zip found under $saves" -ForegroundColor Red + return + } + Write-Host "Latest save: $($latest.FullName)" -ForegroundColor Green + Write-Host "Last saved: $($latest.LastWriteTime)" + Write-Host "Opening Explorer. Drag SaveData.zip onto the sotf-inventory page." + Start-Process explorer.exe -ArgumentList "/select,`"$($latest.FullName)`"" +} diff --git a/README.md b/README.md index 3876cf5..d5c4079 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,14 @@ Live page: https://justinoros.github.io/sotf-inventory/ 6. Click Save to download the new `SaveData.zip`. 7. Replace the old `SaveData.zip` in your save folder with the new one and start the game. +Can't find your save? Close the game, open PowerShell and paste: + +``` +irm https://raw.githubusercontent.com/JustinOros/sotf-inventory/main/Find-SaveData.ps1 | iex +``` + +It opens Explorer with your most recent `SaveData.zip` selected. + A loose `PlayerInventorySaveData.json` also works if you prefer to edit the extracted file. ## Notes @@ -33,6 +41,7 @@ Push the repo, then go to Settings, Pages, and set the source to the `main` bran * `styles.css` theme * `app.js` load, edit, and save logic * `items.js` item IDs, names, categories, and max counts +* `Find-SaveData.ps1` opens Explorer at your latest `SaveData.zip` ## Credits diff --git a/app.js b/app.js index a43da12..72a1b73 100644 --- a/app.js +++ b/app.js @@ -12,6 +12,8 @@ browseBtn: $("browseBtn"), fileInput: $("fileInput"), copyPathBtn: $("copyPathBtn"), + copyCmdBtn: $("copyCmdBtn"), + helperCmd: $("helperCmd"), search: $("search"), category: $("category"), ownedOnly: $("ownedOnly"), @@ -360,6 +362,15 @@ } }); + els.copyCmdBtn.addEventListener("click", async () => { + try { + await navigator.clipboard.writeText(els.helperCmd.textContent.trim()); + toast("Command copied. Paste it into PowerShell and press Enter."); + } catch { + toast("Couldn't copy. Select the command and copy it manually.", true); + } + }); + els.browseBtn.addEventListener("click", browse); els.fileInput.addEventListener("change", () => loadFile(els.fileInput.files[0])); diff --git a/index.html b/index.html index 75dfc45..029d547 100644 --- a/index.html +++ b/index.html @@ -34,6 +34,12 @@ %USERPROFILE%\AppData\LocalLow\Endnight\SonsOfTheForest\Saves\SteamID\SinglePlayer\SaveID\SaveData.zip

SteamID is the long number folder. SaveID is one folder per save; sort by date modified to find your latest. Hosted co-op saves are under Multiplayer folder instead of SinglePlayer.

+

Or let PowerShell find it for you. Close the game, open PowerShell and paste:

+
+ irm https://raw.githubusercontent.com/JustinOros/sotf-inventory/main/Find-SaveData.ps1 | iex + +
+

It opens Explorer with your latest SaveData.zip selected, ready to drag onto this page.

diff --git a/styles.css b/styles.css index 18f21a6..ba4a0f4 100644 --- a/styles.css +++ b/styles.css @@ -163,6 +163,15 @@ main { .copy-btn svg { position: relative; top: 1px; } +.cmd { + display: flex; + gap: 0.75rem; + align-items: center; + width: 100%; +} + +.cmd .path { flex: 1; } + .path-note { margin: 0; max-width: 60em;