Skip to content

Commit e751489

Browse files
committed
Cutting v1.3.3 - Fix startup crash for Windows usernames like u@domain
1 parent 8bb8fe5 commit e751489

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

src/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
OpenBLCMM Changelog
22
===================
33

4+
**v1.3.3** May 26, 2023
5+
- Fixed a startup crash issue for Windows users whose system username has a
6+
@domain suffix which isn't present in their homedir.
7+
48
**v1.3.2** May 24, 2023
59
- Fixed TPS Game Detection on Windows
610
- Importing mods via drag-and-drop will correctly update OpenBLCMM's "last

src/blcmm/Meta.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class Meta {
4444
/**
4545
* App version. Should follow https://semver.org/ conventions.
4646
*/
47-
public static final String VERSION = "1.3.2";
47+
public static final String VERSION = "1.3.3";
4848

4949
/**
5050
* User data directory for storing prefs, extracted data, etc. If NAME

src/blcmm/utilities/Utilities.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,26 @@ public static String hideUserName(String text) {
184184
return text.replace(userHome, "~");
185185
} else {
186186
String userName = System.getProperty("user.name");
187-
String replaced = userHome.substring(0, userHome.length() - userName.length()) + "[user]";
188-
return text.replace(userHome, replaced);
187+
//GlobalLogger.log("user.home: '" + userHome + "'");
188+
//GlobalLogger.log("user.name: '" + userName + "'");
189+
if (!userHome.endsWith(userName) && userName.contains("@")) {
190+
// Sometimes a user might have "@outlook" as part of their username
191+
// which isn't included in the homedir. There's probably a better
192+
// way to be checking for this.
193+
String[] parts = userName.split("@", 2);
194+
userName = parts[0];
195+
}
196+
// This is sort of a double check of the same values in most cases,
197+
// but whatever.
198+
if (userHome.endsWith(userName)) {
199+
String replaced = userHome.substring(0, userHome.length() - userName.length()) + "[user]";
200+
return text.replace(userHome, replaced);
201+
} else {
202+
// Username wasn't found in the homedir, so just give up
203+
// (this logging would be a bit noisy; not bothering with it)
204+
//GlobalLogger.log("Could not figure out how to hide username in homedir!");
205+
return text;
206+
}
189207
}
190208
}
191209
return text;

windows-processing/openblcmm.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "OpenBLCMM"
5-
#define MyAppVersion "1.3.2"
5+
#define MyAppVersion "1.3.3"
66
#define MyAppPublisher "BLCM"
77
#define MyAppURL "https://github.com/BLCM/OpenBLCMM/"
88
#define MyAppExeName "OpenBLCMM.exe"

0 commit comments

Comments
 (0)