Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions lib/java/JavaGuard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { dirname, join } from 'path'
import { promisify } from 'util'
import { LauncherJson } from '../model/mojang/LauncherJson'
import { LoggerUtil } from '../util/LoggerUtil'
import { getDiskInfo } from 'node-disk-info'
import Registry from 'winreg'
import semver from 'semver'
import { Asset, HashAlgo } from '../dl'
Expand Down Expand Up @@ -1019,7 +1018,7 @@ export async function getWin32Discoverers(dataDir: string): Promise<JavaDiscover
return [
new EnvironmentBasedJavaDiscoverer(getPossibleJavaEnvs()),
new DirectoryBasedJavaDiscoverer([
...(await getPathsOnAllDrives([
...(await getPathsOnAllDrivesWin32([
'Program Files\\Java',
'Program Files\\Eclipse Adoptium',
'Program Files\\Eclipse Foundation',
Expand Down Expand Up @@ -1055,8 +1054,25 @@ export async function getLinuxDiscoverers(dataDir: string): Promise<JavaDiscover
]
}

export async function getPathsOnAllDrives(paths: string[]): Promise<string[]> {
const driveMounts = (await getDiskInfo()).map(({ mounted }) => mounted)
export async function win32DriveMounts(): Promise<string[]> {

const execAsync = promisify(exec)

let stdout
try {
stdout = (await execAsync('gdr -psp FileSystem | select -eXp root | ConvertTo-Json', {shell: 'powershell.exe'})).stdout
} catch(error) {
log.error('Failed to resolve drive mounts!')
log.error(error)
// Default to C:\\
return ['C:\\']
}

return JSON.parse(stdout)
}

export async function getPathsOnAllDrivesWin32(paths: string[]): Promise<string[]> {
const driveMounts = await win32DriveMounts()
const res: string[] = []
for(const path of paths) {
for(const mount of driveMounts) {
Expand Down
40 changes: 6 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rgblauncher-core",
"version": "1.0.1",
"version": "1.0.5",
"description": "A library containing core mechanisms for RGB Launcher",
"main": "dist/index.js",
"scripts": {
Expand Down Expand Up @@ -44,19 +44,19 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/Enn3Developer/rgblauncher-core.git"
"url": "git+https://github.com/rgbcraft/rgblauncher-core.git"
},
"keywords": [
"rgb-launcher",
"rgblauncher-core",
"minecraft-launcher"
],
"author": "Enn3Developer",
"author": "lego11",
"license": " LGPL-3.0-only",
"bugs": {
"url": "https://github.com/Enn3Developer/rgblauncher-core/issues"
"url": "https://github.com/rgbcraft/rgblauncher-core/issues"
},
"homepage": "https://github.com/Enn3Developer/rgblauncher-core#readme",
"homepage": "https://github.com/rgbcraft/rgblauncher-core#readme",
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/chai-as-promised": "^7.1.5",
Expand Down Expand Up @@ -84,9 +84,8 @@
"fs-extra": "^11.1.1",
"got": "^11.8.6",
"luxon": "^3.3.0",
"node-disk-info": "^1.3.0",
"node-stream-zip": "^1.15.0",
"rgblauncher-distribution-types": "^1.0.0",
"rgblauncher-distribution-types": "^1.0.2",
"semver": "^7.4.0",
"tar-fs": "^2.1.1",
"triple-beam": "^1.3.0",
Expand Down
3 changes: 1 addition & 2 deletions test/mojang/net/ServerStatusAPITest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ function verifyResult(res: ServerStatus): void {
}

const serversToCheck = [
'play.hypixel.net',
'mc.hypixel.net',
'mc.westeroscraft.com',
'us.mineplex.com',
// 'stoneblock.colaian.tech' // SRV - commented out b/c may be shut down.
]

Expand Down