Skip to content

Commit 5ea4615

Browse files
committed
Refactor ReleaseType to add displayName, update CreateDeb to use ReleaseType.displayName in .desktop file formatting
1 parent abdff91 commit 5ea4615

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

buildSrc/src/main/java/org/jackhuang/hmcl/gradle/pack/CreateDeb.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,14 +287,14 @@ private String getDesktopInfo() {
287287
return """
288288
[Desktop Entry]
289289
Type=Application
290-
Name=HMCL
290+
Name=%s
291291
Comment=Hello Minecraft! Launcher
292292
Exec=%s
293293
Icon=%s
294294
Terminal=false
295295
StartupNotify=false
296296
Categories=Game;
297297
Keywords=mc;minecraft;
298-
""".formatted(getLauncherPath(), getIconTargetPath());
298+
""".formatted(getCurrentType().getDisplayName(), getLauncherPath(), getIconTargetPath());
299299
}
300300
}

buildSrc/src/main/java/org/jackhuang/hmcl/gradle/pack/ReleaseType.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,19 @@
2323
/// priority are intentionally centralized here so `CreateDeb` can stay focused
2424
/// on archive layout instead of duplicating channel-specific branching.
2525
public enum ReleaseType {
26-
STABLE("stable", "hmcl", 300),
27-
DEVELOPMENT("dev", "hmcl-dev", 200),
28-
NIGHTLY("nightly", "hmcl-nightly", 100);
26+
STABLE("stable", "hmcl", "HMCL", 100),
27+
DEVELOPMENT("dev", "hmcl-dev", "HMCL (Beta)", 200),
28+
NIGHTLY("nightly", "hmcl-nightly", "HMCL (Nightly)", 300);
2929

30-
public final String name;
30+
private final String name;
3131
private final String packageName;
32+
private final String displayName;
3233
private final int alternativesPriority;
3334

34-
ReleaseType(String name, String packageName, int alternativesPriority) {
35+
ReleaseType(String name, String packageName, String displayName, int alternativesPriority) {
3536
this.name = name;
3637
this.packageName = packageName;
38+
this.displayName = displayName;
3739
this.alternativesPriority = alternativesPriority;
3840
}
3941

@@ -47,6 +49,10 @@ public String getPackageName() {
4749
return packageName;
4850
}
4951

52+
public String getDisplayName() {
53+
return displayName;
54+
}
55+
5056
/// Priority used when registering the generic `hmcl` alias.
5157
///
5258
/// Higher values win, which keeps `stable` as the default alias target when

0 commit comments

Comments
 (0)