From 4f131d16d5f41b3eb26969c274b9fff5aec22f8d Mon Sep 17 00:00:00 2001 From: Scott Martin Date: Mon, 1 Jan 2024 21:47:45 +0000 Subject: [PATCH] [minecraft-onedrive-linker] New tool --- README.md | 7 +-- index.html | 1 + .../MinecraftOneDriveLinker.bat | 43 +++++++++++++++++++ minecraft-onedrive-linker/README.md | 38 ++++++++++++++++ 4 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 minecraft-onedrive-linker/MinecraftOneDriveLinker.bat create mode 100644 minecraft-onedrive-linker/README.md diff --git a/README.md b/README.md index 7a38f75..8c16772 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ # Scott's Tools -Small web-based utilities for fixing data in one way or another. +Small utilities, mostly for fixing data in one way or another. +* Bookmarklets: open `bookmarklets/index.html` in your browser +* [Minecraft OneDrive Linker](minecraft-onedrive-linker/README.md) ![New!](assets/new.gif) * [Renaming Script Generator](renaming-script-generator/README.md) -* [Strip URL Parameters](strip-url-params/README.md) ![New!](assets/new.gif) * [VLC Playlist Fixer](vlc-playlist-fixer/README.md) ## Author and license -Copyright 2022 [Scott Martin](https://github.com/scottdotjs). +Copyright [Scott Martin](https://github.com/scottdotjs). Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. diff --git a/index.html b/index.html index f73b078..d1722cf 100644 --- a/index.html +++ b/index.html @@ -26,6 +26,7 @@

Scott’s Tools

diff --git a/minecraft-onedrive-linker/MinecraftOneDriveLinker.bat b/minecraft-onedrive-linker/MinecraftOneDriveLinker.bat new file mode 100644 index 0000000..91c0549 --- /dev/null +++ b/minecraft-onedrive-linker/MinecraftOneDriveLinker.bat @@ -0,0 +1,43 @@ +@echo off + +set /p HasBackup="Have you backed up your Minecraft folder? [y/n] " + +if not "%HasBackup%"=="Y" if not "%HasBackup%"=="y" ( + echo Please back up your Minecraft folder first. + pause + exit +) + +set /p MinecraftFolderLocation="Enter the path to your Minecraft folder within your OneDrive folder, not including the path to OneDrive itself (eg. path\to\folder): " + +if not defined MinecraftFolderLocation ( + echo Please start again and enter something this time. + pause + exit +) + +set MinecraftFolderPath=%userprofile%\OneDrive\%MinecraftFolderLocation%\.minecraft + +if exist "%appdata%\.minecraft" ( + echo There's already a .minecraft in %appdata%, please check. + pause + exit +) + +if not exist %MinecraftFolderPath% ( + echo There's no Minecraft folder at %MinecraftFolderPath%, please check. + pause + exit +) + +mklink /J "%appdata%\.minecraft" "%userprofile%\OneDrive\%MinecraftFolderLocation%\.minecraft" + +chcp 65001 >nul + +echo ╔════════════════════════════════════════════════════════════════════════════╗ +echo ║ VERY IMPORTANT: ║ +echo ║ Go to where your Minecraft folder is, right-click it, and choose ║ +echo ║ "Always keep on this device". It might get corrupted if you don't! ║ +echo ╚════════════════════════════════════════════════════════════════════════════╝ + +pause diff --git a/minecraft-onedrive-linker/README.md b/minecraft-onedrive-linker/README.md new file mode 100644 index 0000000..53904d4 --- /dev/null +++ b/minecraft-onedrive-linker/README.md @@ -0,0 +1,38 @@ +# Minecraft OneDrive Linker + +This Windows batch script will let you keep your Minecraft game data folder on +OneDrive and thus synchronized between different computers. + +# How to use it + +Before doing anything: MAKE A BACKUP OF YOUR MINECRAFT FOLDER. This script +comes with no guarantees! On Windows it's called `.minecraft` and is found in +the `%AppData%` folder. Type that into the Explorer address bar and it will +expand to the full path. + +On the computer that has the Minecraft installation you want to synchronize: + +1. Move your Minecraft folder into wherever you want to keep it in your OneDrive folder. +2. Run the script by double-clicking it and answer the prompts. +3. Wait for the folder to finish uploading to OneDrive. + +On the other computer(s): + +1. Move any existing Minecraft folder out of `%AppData%`. +2. Run the script by double-clicking it and answer the prompts. +3. Wait for the folder to finish downloading from OneDrive. + +Go mine and craft! + +# Important note + +The script will tell you how to get OneDrive to always keep a local copy of the folder (exempt it from Files On-Demand). If you don't there's a risk of the game getting confused looking for files that aren't technically there. Also, when switching between machines, YOU MUST wait for the game files to sync up and then down again before starting to play. + +# Putting things back how they were + +Delete the `.minecraft` directory link in `%AppData%` and move the real folder back there. Obviously make sure it's fully synchronized before doing that. + +# DISCLAIMER + +This is a very hacky workaround for OneDrive not letting you add arbitrary file paths. This software comes with no guarantees or warranty of usefulness whatsoever and you run it at your own risk. Regularly back up your Minecraft folder! +