MacOS attempted fix with file:// prefix

more-targets
Daniel Lovell 2024-09-25 18:35:00 -07:00
parent a829a05264
commit c0b95b2fa7
2 changed files with 21 additions and 3 deletions

View File

@ -1,6 +1,12 @@
name: Build project name: Build project
on: [push, pull_request] on:
push:
branches:
- release
pull_request:
branches:
- release
jobs: jobs:
buildForAllSupportedPlatforms: buildForAllSupportedPlatforms:
@ -30,6 +36,8 @@ jobs:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with: with:
buildName: micromissiles-${{ github.run_number }}-${{ matrix.targetPlatform }}
versioning: Semantic
targetPlatform: ${{ matrix.targetPlatform }} targetPlatform: ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:

View File

@ -3,8 +3,17 @@ using UnityEngine;
using Newtonsoft.Json; using Newtonsoft.Json;
public static class ConfigLoader { public static class ConfigLoader {
private static string NormalizePath(string path) {
if (Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.LinuxPlayer) {
if (!path.StartsWith("file://")) {
return "file://" + path;
}
}
return path;
}
public static SimulationConfig LoadSimulationConfig(string configFileName) { public static SimulationConfig LoadSimulationConfig(string configFileName) {
string configFilePath = Path.Combine(Application.streamingAssetsPath, "Configs", configFileName); string configFilePath = NormalizePath(Path.Combine(Application.streamingAssetsPath, "Configs", configFileName));
if (File.Exists(configFilePath)) { if (File.Exists(configFilePath)) {
string json = File.ReadAllText(configFilePath); string json = File.ReadAllText(configFilePath);
SimulationConfig config = JsonConvert.DeserializeObject<SimulationConfig>(json, new JsonSerializerSettings { SimulationConfig config = JsonConvert.DeserializeObject<SimulationConfig>(json, new JsonSerializerSettings {
@ -18,7 +27,7 @@ public static class ConfigLoader {
} }
public static StaticConfig LoadStaticConfig(string configFileName) { public static StaticConfig LoadStaticConfig(string configFileName) {
string configFilePath = Path.Combine(Application.streamingAssetsPath, "Configs/Models", configFileName); string configFilePath = NormalizePath(Path.Combine(Application.streamingAssetsPath, "Configs/Models", configFileName));
if (File.Exists(configFilePath)) { if (File.Exists(configFilePath)) {
string json = File.ReadAllText(configFilePath); string json = File.ReadAllText(configFilePath);
StaticConfig config = JsonConvert.DeserializeObject<StaticConfig>(json, new JsonSerializerSettings { StaticConfig config = JsonConvert.DeserializeObject<StaticConfig>(json, new JsonSerializerSettings {
@ -31,6 +40,7 @@ public static class ConfigLoader {
} }
} }
public static void PrintSimulationConfig(SimulationConfig config) public static void PrintSimulationConfig(SimulationConfig config)
{ {
if (config == null) if (config == null)