Find ffmpeg.exe anywhere in .minecraft folder (closes #347)
Thanks to Lucky56 for testing!
This commit is contained in:
@@ -22,14 +22,17 @@ To render your creations with **Replay Mod** you will need to have FFmpeg instal
|
||||
### Windows [windows]
|
||||
Download the **latest** FFmpeg build from <http://ffmpeg.zeranoe.com/builds/>.
|
||||
|
||||
In your `.minecraft` folder, create a `ffmpeg` folder. Extract the downloaded .zip file into this folder. The FFmpeg executable should end up at `.minecraft\ffmpeg\bin\ffmpeg.exe`.
|
||||
Extract the downloaded .zip file into your `.minecraft` folder.
|
||||
|
||||
Historically the exact location inside the `.minecraft` folder was important, this is no longer the case.
|
||||
It is sufficient for the `ffmpeg.exe` to be anywhere inside your `.minecraft` folder.
|
||||
|
||||
**Notes for alternative launchers**
|
||||
- Twitch launcher by default installs Minecraft instances in C:\\Users\\*username*\\Twitch\\Minecraft\\Instances\\*instancename*\\
|
||||
- GD Launcher by default installs Minecraft instances in C:\\Users\\*username*\\AppData\\Roaming\\gdlauncher_next\\instances\\*instancename*\\
|
||||
- MultiMC by default installs Minecraft instances in C:\\Program Files (x86)\\MultiMC\\instances\\*Instancename*\\.minecraft\\
|
||||
|
||||
For these launchers, make sure FFmpeg exists in `instancename\ffmpeg\bin\ffmpeg.exe` (Twitch / GD) or `Instancename\.minecraft\ffmpeg\bin\ffmpeg.exe` (MultiMC)
|
||||
For these launchers, make sure FFmpeg exists inside the corresponding folder.
|
||||
|
||||
### Mac OSX [mac]
|
||||
On OSX, you can install **FFmpeg** with **[Homebrew](http://brew.sh/)** using `brew install ffmpeg`.
|
||||
|
||||
@@ -7,6 +7,12 @@ import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.util.Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Optional;
|
||||
@@ -253,11 +259,35 @@ public class RenderSettings {
|
||||
switch (Util.getOperatingSystem()) {
|
||||
case WINDOWS:
|
||||
// Allow windows users to unpack the ffmpeg archive into a sub-folder of their .minecraft folder
|
||||
File inDotMinecraft = new File(MCVer.getMinecraft().runDirectory, "ffmpeg/bin/ffmpeg.exe");
|
||||
File dotMinecraft = MCVer.getMinecraft().runDirectory;
|
||||
File inDotMinecraft = new File(dotMinecraft, "ffmpeg/bin/ffmpeg.exe");
|
||||
if (inDotMinecraft.exists()) {
|
||||
LOGGER.debug("FFmpeg found in .minecraft/ffmpeg");
|
||||
return inDotMinecraft.getAbsolutePath();
|
||||
}
|
||||
// But a significant amount of people are not even able to follow instruction to do that.
|
||||
// Instead they'll regularly put it at `.minecraft/ffmpeg-version/bin/ffmpeg.exe`
|
||||
// or `.minecraft/ffmpeg/ffmpeg-version/bin/ffmpeg.exe`
|
||||
// So, for support's sake, let's just search the entire .minecraft folder for an `ffmpeg.exe` file.
|
||||
// We retain above check to have a fast path for any old installations.
|
||||
try {
|
||||
Path[] result = new Path[1];
|
||||
Files.walkFileTree(dotMinecraft.toPath(), new SimpleFileVisitor<Path>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
if ("ffmpeg.exe".equals(file.getFileName().toString())) {
|
||||
result[0] = file;
|
||||
return FileVisitResult.TERMINATE;
|
||||
}
|
||||
return super.visitFile(file, attrs);
|
||||
}
|
||||
});
|
||||
if (result[0] != null) {
|
||||
return result[0].toAbsolutePath().toString();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOGGER.debug("Error searching .minecraft for ffmpeg.exe:", e);
|
||||
}
|
||||
break;
|
||||
case OSX:
|
||||
// The PATH doesn't seem to be set as expected on OSX, therefore we check some common locations ourselves
|
||||
|
||||
Reference in New Issue
Block a user