Skip to content

Commit b4c402b

Browse files
committed
Fix installer failing to install on the vanilla launcher.
1 parent 2a85f86 commit b4c402b

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2023-2025 Fox2Code
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package com.fox2code.foxloader.installer;
25+
26+
import com.fox2code.foxloader.dependencies.DependencyHelper;
27+
28+
import java.net.URL;
29+
30+
final class InstallerDependencyHelperImpl extends DependencyHelper.DependencyImpl {
31+
static final InstallerDependencyHelperImpl INSTANCE = new InstallerDependencyHelperImpl();
32+
33+
@Override
34+
public boolean hasClass(String cls) {
35+
return InstallerDependencyHelperImpl.class.getClassLoader()
36+
.getResource(cls.replace('.', '/') + ".class") != null;
37+
}
38+
39+
@Override
40+
public boolean isDev() {
41+
return true;
42+
}
43+
44+
@Override
45+
public URL getClassResource(String className) {
46+
return InstallerDependencyHelperImpl.class.getClassLoader()
47+
.getResource(className.replace('.', '/') + ".class");
48+
}
49+
}

loader/src/main/java/com/fox2code/foxloader/installer/InstallerGUI.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.fox2code.foxloader.launcher.LauncherType;
2929
import com.fox2code.foxloader.utils.Platform;
3030
import com.fox2code.foxloader.utils.StackTraceStringifier;
31+
import com.fox2code.foxloader.utils.io.CertificateHelper;
3132
import com.fox2code.foxloader.utils.io.IOUtils;
3233

3334
import javax.swing.*;
@@ -74,6 +75,9 @@ final class InstallerGUI {
7475
private final String versionName;
7576

7677
public InstallerGUI(InstallerPlatform installerPlatform) {
78+
DependencyHelper.DependencyImpl.install(InstallerDependencyHelperImpl.INSTANCE);
79+
DependencyHelper.setMCLibraryRoot(new File(Platform.getAppDir("minecraft"), "libraries"));
80+
CertificateHelper.initializeSafe();
7781
this.installerPlatform = installerPlatform;
7882
this.launcherType = null;
7983
versionName = DEFAULT_VERSION_NAME;

0 commit comments

Comments
 (0)