Skip to content

Commit 38d3a96

Browse files
committed
Fixed path generation again.
1 parent 393433a commit 38d3a96

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

Unity2Debug.Common/SettingsService/Settings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private void GenerateDefaultProfiles()
160160
{
161161
AssemblyPaths =
162162
[
163-
Path.Combine(wrathPath, "Wrath_Data\\Managed\\Assembly-CSharp.dll",
163+
Path.Combine(wrathPath, "Wrath_Data\\Managed\\Assembly-CSharp.dll"),
164164
Path.Combine(wrathPath, "Wrath_Data\\Managed\\Assembly-CSharp-firstpass.dll"),
165165
Path.Combine(wrathPath, "Wrath_Data\\Managed\\Core.Async.dll"),
166166
Path.Combine(wrathPath, "Wrath_Data\\Managed\\Core.Cheats.dll"),
@@ -187,7 +187,7 @@ private void GenerateDefaultProfiles()
187187
Path.Combine(wrathPath, "Wrath_Data\\Managed\\Owlcat.Runtime.Validation.dll"),
188188
Path.Combine(wrathPath, "Wrath_Data\\Managed\\Owlcat.Runtime.Visual.dll"),
189189
Path.Combine(wrathPath, "Wrath_Data\\Managed\\Owlcat.SharedTypes.dll")
190-
) ],
190+
]
191191
},
192192
new()
193193
{

Unity2Debug.Common/Utility/Extensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ public static string TrimSeparator(this string s)
88
return s.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
99
}
1010

11+
public static string NormalizePath(this string path) => Path.Combine(path.Split('/', '\\'));
12+
1113
public static string EnsureSeparator(this string s)
1214
{
1315
if (s.EndsWith(Path.DirectorySeparatorChar) || s.EndsWith(Path.AltDirectorySeparatorChar))

Unity2Debug.Common/Utility/OwlCatUtil.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,19 @@ namespace Unity2Debug.Common.Utility
1111
{
1212
internal class OwlCatUtil
1313
{
14-
public static string FindWrathPath() => FindInstallLocation("Pathfinder Wrath Of The Righteous", "Player.log", @"^Mono path\[0\] = '(.*?)/Wrath_Data/Managed'$");
15-
public static string FindRTPath() => FindInstallLocation("Warhammer 40000 Rogue Trader", "Player.log", @"^Mono path\[0\] = '(.*?)/WH40KRT_Data/Managed'$");
16-
public static string FindKMPath() => FindInstallLocation("Pathfinder Kingmaker", "output_log.txt", @"^Mono path\[0\] = '(.*?)/Kingmaker_Data/Managed'$");
14+
public static string FindWrathPath() => FindInstallLocation("Pathfinder Wrath Of The Righteous", "Player.log", "Mono path[0]", @"^Mono path\[0\] = '(.*?)/Wrath_Data/Managed'$").NormalizePath();
15+
public static string FindRTPath() => FindInstallLocation("Warhammer 40000 Rogue Trader", "Player.log", "Mono path[0]", @"^Mono path\[0\] = '(.*?)/WH40KRT_Data/Managed'$").NormalizePath();
16+
public static string FindKMPath() => FindInstallLocation("Pathfinder Kingmaker", "output_log.txt", "[Manager] Mods path:", @"^\[Manager\] Mods path: (.*?)\\Mods.$").NormalizePath();
1717

18-
private static string FindInstallLocation(string gameFolderName, string logName, string regex)
18+
private static string FindInstallLocation(string gameFolderName, string logName, string toFind, string regex)
1919
{
2020
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
2121
{
22-
var rogueTraderDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low", "Owlcat Games", gameFolderName, logName);
23-
string lineToFind = "Mono path[0]";
22+
var DataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low", "Owlcat Games", gameFolderName, logName);
2423
var line = string.Empty;
25-
foreach (var lineIter in File.ReadLines(rogueTraderDataPath))
24+
foreach (var lineIter in File.ReadLines(DataPath))
2625
{
27-
if (lineIter.Contains(lineToFind))
26+
if (lineIter.Contains(toFind))
2827
{
2928
line = lineIter;
3029
break;

0 commit comments

Comments
 (0)