Skip to content

Commit 5f659cc

Browse files
More changes
1 parent 87b4a18 commit 5f659cc

6 files changed

Lines changed: 73 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Download the Flatpak bundle (file ending with .flatpak) from the [releases page]
7272
### Bug/Issue Reporting
7373
Unless written and submitted properly for tracking, issues wwill need to be posted in the [discussion forum](https://github.com/hedge-dev/HedgeModManager/discussions).
7474

75-
Please avoid creating issues in the Issues tab unless you know what you are doing.
75+
Please avoid creating issues in the Issues tab unless you know what you are doing. Incorrect reporting of issues with the Issues tab will lead to the issue being closed.
7676

7777
Make sure to explain in as much detail as you can on what you have done that caused the issue and if you are able to reproduce the same error/crash. If reproducable, explain in steps what you did. Please also use common sense.
7878

Source/HedgeModManager/LinuxCompatibility.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,39 @@ public static bool IsPrefixPatched([NotNullWhen(true)] string? path)
148148

149149
return false;
150150
}
151+
152+
public static string ToWinePath(string path)
153+
{
154+
if (string.IsNullOrEmpty(path))
155+
{
156+
return string.Empty;
157+
}
158+
159+
// Root path
160+
if (path.StartsWith("/"))
161+
{
162+
return "Z:\\" + path.Replace("/", "\\");
163+
}
164+
165+
// Unknown path
166+
return path.Replace("/", "\\");
167+
}
168+
169+
public static string ToUnixPath(string path)
170+
{
171+
if (string.IsNullOrEmpty(path))
172+
{
173+
return string.Empty;
174+
}
175+
176+
// Root path
177+
if (path.StartsWith("Z:\\"))
178+
{
179+
return "/" + path[3..].Replace("\\", "/");
180+
}
181+
182+
// Unknown path
183+
return path.Replace("\\", "/");
184+
}
185+
151186
}

Source/HedgeModManager/ModDatabaseGeneric.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class ModDatabaseGeneric : IModDatabase, IIncludeResolver
1919
public List<ModGeneric> Mods { get; set; } = [];
2020
public List<CSharpCode> Codes { get; set; } = [];
2121
public bool SupportsCodeCompilation { get; set; } = true;
22+
public string NativeOS { get; set; } = "Windows";
2223

2324
public async Task Save()
2425
{
@@ -45,7 +46,13 @@ public async Task Save()
4546
favoriteMods.Add(id.ToString());
4647
}
4748

48-
modsSection.Set(id.ToString(), Path.Combine(mod.Root, ModGeneric.ConfigName));
49+
string modPath = Path.Combine(mod.Root, ModGeneric.ConfigName);
50+
if (OperatingSystem.IsLinux() && NativeOS == "Windows")
51+
{
52+
modPath = LinuxCompatibility.ToWinePath(modPath);
53+
}
54+
55+
modsSection.Set(id.ToString(), modPath);
4956
}
5057

5158
foreach (var code in Codes)

Source/HedgeModManager/ModLoaderConfiguration.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class ModLoaderConfiguration : IModLoaderConfiguration
1010
public bool EnableSaveFileRedirection { get; set; } = false;
1111
public string DatabasePath { get; set; } = string.Empty;
1212
public string LogType { get; set; } = "none";
13+
public string NativeOS { get; set; } = "Windows";
1314

1415
public void Parse(Ini ini)
1516
{
@@ -19,6 +20,12 @@ public void Parse(Ini ini)
1920
EnableSaveFileRedirection = group.Get<int>("EnableSaveFileRedirection") != 0;
2021

2122
DatabasePath = group.Get<string>("ModsDbIni");
23+
24+
if (OperatingSystem.IsLinux() && NativeOS == "Windows")
25+
{
26+
DatabasePath = LinuxCompatibility.ToUnixPath(DatabasePath);
27+
}
28+
2229
LogType = group.Get<string>("LogType");
2330
}
2431
}
@@ -28,7 +35,14 @@ public void Serialize(Ini ini)
2835
var group = ini.GetOrAddValue(LegacySectionName);
2936
group.Set("Enabled", Enabled ? 1 : 0);
3037
group.Set("EnableSaveFileRedirection", EnableSaveFileRedirection ? 1 : 0);
31-
group.Set("ModsDbIni", DatabasePath);
38+
if (OperatingSystem.IsLinux() && NativeOS == "Windows")
39+
{
40+
group.Set("ModsDbIni", LinuxCompatibility.ToWinePath(DatabasePath));
41+
}
42+
else
43+
{
44+
group.Set("ModsDbIni", DatabasePath);
45+
}
3246
group.Set("LogType", LogType);
3347
}
3448

Source/HedgeModManager/ModdableGameGeneric.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
public class ModdableGameGeneric : IModdableGameTDatabase<ModDatabaseGeneric>, IModdableGameTConfiguration<ModLoaderConfiguration>
77
{
8+
private string _nativeOS = "Windows";
9+
810
public IGame BaseGame { get; }
911

1012
public string Platform => BaseGame.Platform;
@@ -14,7 +16,6 @@ public class ModdableGameGeneric : IModdableGameTDatabase<ModDatabaseGeneric>, I
1416
public string? Executable { get; set; }
1517
public string DefaultDatabaseDirectory { get; set; } = "mods";
1618
public string ModLoaderName { get; init; } = "None";
17-
public string NativeOS { get; set; } = "Windows";
1819
public string? PrefixRoot => BaseGame.PrefixRoot;
1920
public bool SupportsDirectLaunch { get; set; }
2021
public bool SupportsLauncher { get; set; }
@@ -23,6 +24,16 @@ public class ModdableGameGeneric : IModdableGameTDatabase<ModDatabaseGeneric>, I
2324
public ModDatabaseGeneric ModDatabase { get; } = new ModDatabaseGeneric();
2425
public ModLoaderConfiguration ModLoaderConfiguration { get; set; } = new ModLoaderConfiguration();
2526
public ModLoaderGeneric? ModLoader { get; set; }
27+
public string NativeOS
28+
{
29+
get => _nativeOS;
30+
set
31+
{
32+
_nativeOS = value;
33+
ModDatabase.NativeOS = value;
34+
ModLoaderConfiguration.NativeOS = value;
35+
}
36+
}
2637

2738
public ModdableGameGeneric(IGame game)
2839
{

flatpak/hedgemodmanager.metainfo.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<summary>Manage mods for HE Sonic games</summary>
77
<developer_name>hedge-dev</developer_name>
88
<url type="homepage">https://github.com/hedge-dev/HedgeModManager</url>
9+
<url type="bugtracker">https://github.com/hedge-dev/HedgeModManager/issues</url>
10+
<url type="help">https://github.com/hedge-dev/HedgeModManager/discussions</url>
911
<url type="vcs-browser">https://github.com/hedge-dev/HedgeModManager</url>
1012

1113
<metadata_license>CC0-1.0</metadata_license>

0 commit comments

Comments
 (0)