-
Notifications
You must be signed in to change notification settings - Fork 12
Macos support #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Macos support #28
Changes from 18 commits
67b59ce
8c956b4
6f941d9
409d8a0
70d5b0b
6aee6fe
2a4b84f
db07d96
e0ed516
f1e7c13
b8b3adb
a2ae2a1
73e5474
2993c29
e758958
1d2f7ea
9fab194
e4bc8ad
8459403
466a041
b88eacd
f11c76a
56f7431
b6b158e
9bb00f0
37f9d2d
bc7f08a
dbe4881
a3b7422
1b08a77
0a3be97
25decd2
964a1d7
c456b48
32b4237
83ace70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,11 +6,11 @@ on: | |
| version: | ||
| description: 'Version' | ||
| required: true | ||
| default: '8.0.0.2' | ||
| default: '8.0.0.3' | ||
| tag: | ||
| description: 'Tag' | ||
| required: true | ||
| default: '8.0.0-beta2' | ||
| default: '8.0.0-beta3' | ||
| prerelease: | ||
| description: 'Prerelease' | ||
| required: true | ||
|
|
@@ -19,6 +19,8 @@ on: | |
| env: | ||
| PROJECT_PATH: ./Source/HedgeModManager.UI/HedgeModManager.UI.csproj | ||
| FLATPAK_ID: io.github.hedge_dev.hedgemodmanager | ||
| MACOS_ID: com.hedge_dev.hedgemodmanager | ||
|
thesupersonic16 marked this conversation as resolved.
Outdated
|
||
| MACOS_BUILD_SCRIPT: ./macos/generate-bundle.bash | ||
|
thesupersonic16 marked this conversation as resolved.
|
||
| GENERATOR_URL: https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/refs/heads/master/dotnet/flatpak-dotnet-generator.py | ||
| DOTNET_VERSION: 8 | ||
| DOTNET_CLI_HOME: /tmp/.dotnet | ||
|
|
@@ -82,12 +84,19 @@ jobs: | |
|
|
||
| - name: Build Flatpak Bundle | ||
| run: flatpak build-bundle repo ./flatpak/${{env.FLATPAK_ID}}.flatpak ${{env.FLATPAK_ID}} | ||
|
|
||
| - name: osx-arm64 Build | ||
| run: dotnet publish -p:PublishProfile=osx-arm64 -c Release -p:AssemblyVersion=${{ github.event.inputs.version }} -p:FileVersion=${{ github.event.inputs.version }} -o ./output/osx-arm64 ${{env.PROJECT_PATH}} -p:UseAppHost=true | ||
|
|
||
| - name: Build osx-arm64 Bundle | ||
| run: /bin/bash ${{env.MACOS_BUILD_SCRIPT}} ${{ github.event.inputs.version }} ${{ env.MACOS_ID }} | ||
|
|
||
| - name: Prepare Release | ||
| run: | | ||
| mkdir -p ./release | ||
| mv ./output/win-x64/HedgeModManager.UI.exe ./release/HedgeModManager.exe | ||
| mv ./flatpak/${{env.FLATPAK_ID}}.flatpak ./release/${{env.FLATPAK_ID}}.flatpak | ||
| mv ./output/osx-arm64/HedgeModManager.app ./release/HedgeModManager.app | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can bundles support multi-arch? Like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. macOS bundles have supported multi-arch since the PowerPC -> Intel transition; the bundle doesn't have to be exclusively |
||
|
|
||
| - name: Create Release | ||
| uses: softprops/action-gh-release@v2.2.1 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -215,3 +215,4 @@ _Pvt_Extensions/ | |
| ModelManifest.xml | ||
|
|
||
| Ignored/ | ||
| .DS_Store | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,4 +12,4 @@ | |
| <ProjectReference Include="..\HedgeModManager\HedgeModManager.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
| </Project> | ||
|
thesupersonic16 marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <Project> | ||
| <PropertyGroup> | ||
| <RuntimeIdentifiers>osx-arm64</RuntimeIdentifiers> | ||
| <PublishSingleFile>true</PublishSingleFile> | ||
| <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract> | ||
| <SelfContained>true</SelfContained> | ||
| </PropertyGroup> | ||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <Project> | ||
| <PropertyGroup> | ||
| <RuntimeIdentifiers>osx-x64</RuntimeIdentifiers> | ||
| <PublishSingleFile>true</PublishSingleFile> | ||
| <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract> | ||
| <SelfContained>false</SelfContained> | ||
| </PropertyGroup> | ||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,7 +45,7 @@ public partial class MainWindowViewModel : ViewModelBase | |
| [ObservableProperty] private string _lastLog = ""; | ||
| [ObservableProperty] private string _message = ""; | ||
| [ObservableProperty] private TabInfo? _currentTabInfo; | ||
| [ObservableProperty] private TabInfo[] _tabInfos = | ||
| [ObservableProperty] private TabInfo[] _tabInfos = | ||
| [new ("Loading"), new("Setup"), new("Mods"), new("Codes"), new("Settings"), new("About"), new("Test")]; | ||
| [ObservableProperty] private ObservableCollection<Modal> _modals = []; | ||
| [ObservableProperty] private ObservableCollection<IMod> _mods = []; | ||
|
|
@@ -82,6 +82,7 @@ public MainWindowViewModel(UILogger logger, List<LanguageEntry> languages) | |
| Logger.Information($"Startup Date: {DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} (UTC)"); | ||
| Logger.Debug($"IsWindows: {OperatingSystem.IsWindows()}"); | ||
| Logger.Debug($"IsLinux: {OperatingSystem.IsLinux()}"); | ||
| Logger.Debug($"IsMacos: {OperatingSystem.IsMacOS()}"); | ||
| Logger.Debug($"RID: {RuntimeInformation.RuntimeIdentifier}"); | ||
| Logger.Debug($"FlatpakID: \"{Program.FlatpakID}\" ({!string.IsNullOrEmpty(Program.FlatpakID)})"); | ||
| Logger.Debug($"InstallLocation: {Program.InstallLocation}"); | ||
|
|
@@ -109,7 +110,7 @@ public async Task CheckForManagerUpdatesAsync() | |
| .OnRun(async (d, c) => | ||
| { | ||
| d.CreateProgress().ReportMax(-1); | ||
|
|
||
| var (update, status) = await Updater.CheckForUpdates(); | ||
| if (update == null) | ||
| { | ||
|
|
@@ -337,7 +338,7 @@ await CreateSimpleDownload("Download.Text.InstallModLoader", "Failed to install | |
| var gameGeneric = GetModdableGameGeneric(); | ||
| if (gameGeneric == null || gameGeneric.ModLoader == null) | ||
| return; | ||
|
|
||
| if (install == true) | ||
| _ = await gameGeneric.ModLoader.InstallAsync(); | ||
| else | ||
|
|
@@ -385,7 +386,7 @@ public async Task SwitchProfileAsync() | |
|
|
||
| IsBusy = true; | ||
|
|
||
| await CreateSimpleDownload("Download.Text.SwitchProfileSave", "Failed to switch profiles", | ||
| await CreateSimpleDownload("Download.Text.SwitchProfileSave", "Failed to switch profiles", | ||
| async (d, p, c) => | ||
| { | ||
| var backupProgress = d.CreateProgress(); | ||
|
|
@@ -453,7 +454,18 @@ public async Task SaveAsync(bool setBusy = true) | |
|
|
||
| await SelectedGame.Game.ModDatabase.Save(); | ||
| if (SelectedGame.Game.ModLoaderConfiguration is ModLoaderConfiguration config) | ||
| await config.Save(Path.Combine(SelectedGame.Game.Root, "cpkredir.ini")); | ||
| { | ||
| // For macos, save under the user's Application Support directory. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. *macOS |
||
| if (OperatingSystem.IsMacOS()) | ||
| { | ||
| var appSupportDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); | ||
| await config.Save(Path.Combine( appSupportDir,SelectedGame.Game.Executable, "cpkredir.ini")); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| else | ||
| { | ||
| await config.Save(Path.Combine(SelectedGame.Game.Root, "cpkredir.ini")); | ||
| } | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whats going on here?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. macos executables usually live within the Applications folder (or anywhere you place them) however other files will live in the Application Support folder.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sure the root is set to the directory where the ini is located, this needs to be done in the locator. Since this is different from the app install, change the root directory existance check to check if the .app exist.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change should not exist, please remove it, and later when the Unleashed Recompield macOS code gets approved you can then go fix the pathing issues in the locator. While naming can be confusing,
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Previously I believe the root was used in the run command so by default I set as thr Applications dir. now that that was changed I agree it makes more sense to change this to where the .ini lives aka in Application Support |
||
| } | ||
| catch (UnauthorizedAccessException e) | ||
| { | ||
|
|
@@ -889,7 +901,7 @@ public async Task StartServerAsync() | |
| ServerStatus = 1; | ||
| while (ServerStatus == 1) | ||
| { | ||
| using var server = new NamedPipeServerStream(Program.PipeName, PipeDirection.In, | ||
| using var server = new NamedPipeServerStream(Program.PipeName, PipeDirection.In, | ||
| NamedPipeServerStream.MaxAllowedServerInstances, | ||
| PipeTransmissionMode.Byte, PipeOptions.Asynchronous); | ||
| Logger.Debug("Waiting for connection"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,15 @@ | |
|
|
||
| namespace HedgeModManager; | ||
|
|
||
| public class GameSimple(string platform, string id, string name, string root, string? executable, string nativeOS, string launchCommand, string launchCommandArgs) : IGame | ||
| public class GameSimple( | ||
| string platform, | ||
| string id, | ||
| string name, | ||
| string root, | ||
| string? executable, | ||
| string nativeOS, | ||
| string launchCommand, | ||
| string launchCommandArgs) : IGame | ||
| { | ||
| public string Platform { get; set; } = platform; | ||
| public string ID { get; set; } = id; | ||
|
|
@@ -20,15 +28,29 @@ public class GameSimple(string platform, string id, string name, string root, st | |
| public Task Run(string? launchArgs, bool useLauncher) | ||
| { | ||
| launchArgs ??= LaunchCommandArgs; | ||
|
|
||
| Process.Start(new ProcessStartInfo | ||
| if (OperatingSystem.IsMacOS()) | ||
| { | ||
| FileName = LaunchCommand, | ||
| Arguments = launchArgs ?? string.Empty, | ||
| WorkingDirectory = Root, | ||
| UseShellExecute = true | ||
| }); | ||
| // The command to launch macos apps is | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. *macOS |
||
| // open -a path/to/my/app/appname | ||
| // When the app is inside the Application folder only the app's name is needed. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That being said, I think it would be better to opt for the full file path for specificity. |
||
| Process.Start(new ProcessStartInfo | ||
| { | ||
| FileName = "open", | ||
| Arguments = $"-a {Executable}", | ||
| UseShellExecute = false | ||
| }); | ||
| } | ||
| else | ||
| { | ||
| Process.Start(new ProcessStartInfo | ||
| { | ||
| FileName = LaunchCommand, | ||
| Arguments = launchArgs ?? string.Empty, | ||
| WorkingDirectory = Root, | ||
| UseShellExecute = true | ||
| }); | ||
| } | ||
|
|
||
| return Task.CompletedTask; | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why this is using
com.hedge_dev.hedgemodmanager? Isio.github.hedge_dev.hedgemodmanagerorcom.github.hedge_dev.hedgemodmanagerusable here? hedge-dev does not own/controlhedge_dev.com.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ID can be anything on macOS as long as the code is consistent. I've seen
com,org, andioin Mac app IDs before. I would make it the same as the Flatpak ID for consistency.