Add Find-SaveData.ps1 helper and PowerShell command on loader card
This commit is contained in:
@@ -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)`""
|
||||||
|
}
|
||||||
@@ -14,6 +14,14 @@ Live page: https://justinoros.github.io/sotf-inventory/
|
|||||||
6. Click Save to download the new `SaveData.zip`.
|
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.
|
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.
|
A loose `PlayerInventorySaveData.json` also works if you prefer to edit the extracted file.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
@@ -33,6 +41,7 @@ Push the repo, then go to Settings, Pages, and set the source to the `main` bran
|
|||||||
* `styles.css` theme
|
* `styles.css` theme
|
||||||
* `app.js` load, edit, and save logic
|
* `app.js` load, edit, and save logic
|
||||||
* `items.js` item IDs, names, categories, and max counts
|
* `items.js` item IDs, names, categories, and max counts
|
||||||
|
* `Find-SaveData.ps1` opens Explorer at your latest `SaveData.zip`
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
browseBtn: $("browseBtn"),
|
browseBtn: $("browseBtn"),
|
||||||
fileInput: $("fileInput"),
|
fileInput: $("fileInput"),
|
||||||
copyPathBtn: $("copyPathBtn"),
|
copyPathBtn: $("copyPathBtn"),
|
||||||
|
copyCmdBtn: $("copyCmdBtn"),
|
||||||
|
helperCmd: $("helperCmd"),
|
||||||
search: $("search"),
|
search: $("search"),
|
||||||
category: $("category"),
|
category: $("category"),
|
||||||
ownedOnly: $("ownedOnly"),
|
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.browseBtn.addEventListener("click", browse);
|
||||||
els.fileInput.addEventListener("change", () => loadFile(els.fileInput.files[0]));
|
els.fileInput.addEventListener("change", () => loadFile(els.fileInput.files[0]));
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,12 @@
|
|||||||
</span>
|
</span>
|
||||||
<code class="path"><span>%USERPROFILE%\AppData\LocalLow\Endnight\SonsOfTheForest\Saves\</span><var>SteamID</var><span>\SinglePlayer\</span><var>SaveID</var><span>\SaveData.zip</span></code>
|
<code class="path"><span>%USERPROFILE%\AppData\LocalLow\Endnight\SonsOfTheForest\Saves\</span><var>SteamID</var><span>\SinglePlayer\</span><var>SaveID</var><span>\SaveData.zip</span></code>
|
||||||
<p class="path-note"><var>SteamID</var> is the long number folder. <var>SaveID</var> is one folder per save; sort by date modified to find your latest. Hosted co-op saves are under Multiplayer folder instead of SinglePlayer.</p>
|
<p class="path-note"><var>SteamID</var> is the long number folder. <var>SaveID</var> is one folder per save; sort by date modified to find your latest. Hosted co-op saves are under Multiplayer folder instead of SinglePlayer.</p>
|
||||||
|
<p class="path-note">Or let PowerShell find it for you. Close the game, open PowerShell and paste:</p>
|
||||||
|
<div class="cmd">
|
||||||
|
<code class="path" id="helperCmd">irm https://raw.githubusercontent.com/JustinOros/sotf-inventory/main/Find-SaveData.ps1 | iex</code>
|
||||||
|
<button type="button" class="btn-link copy-btn" id="copyCmdBtn"><svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><rect x="5" y="5" width="9" height="9" rx="1.5" fill="none" stroke="currentColor" stroke-width="1.5"/><path d="M11 5V3.5A1.5 1.5 0 0 0 9.5 2h-6A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5" fill="none" stroke="currentColor" stroke-width="1.5"/></svg><span>Copy</span></button>
|
||||||
|
</div>
|
||||||
|
<p class="path-note">It opens Explorer with your latest SaveData.zip selected, ready to drag onto this page.</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@@ -163,6 +163,15 @@ main {
|
|||||||
|
|
||||||
.copy-btn svg { position: relative; top: 1px; }
|
.copy-btn svg { position: relative; top: 1px; }
|
||||||
|
|
||||||
|
.cmd {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.75rem;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd .path { flex: 1; }
|
||||||
|
|
||||||
.path-note {
|
.path-note {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
max-width: 60em;
|
max-width: 60em;
|
||||||
|
|||||||
Reference in New Issue
Block a user