Skip to content

Commit

Permalink
TB export on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
jetelain committed Aug 23, 2023
1 parent 7d5b65a commit 764dc49
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal class GenerateObjectLayerOptions : MapOptionsBase
[Option('l', "layer", Required = true, HelpText = "Requested layer")]
public string LayerName { get; set; } = string.Empty;

[Option('t', "target", Required = true, HelpText = "Target directpry")]
[Option('t', "target", Required = true, HelpText = "Target directory")]
public string TargetDirectory { get; set; } = string.Empty;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using CommandLine;

namespace GameRealisticMap.Arma3.CommandLine
{
[Verb("gentb")]
internal class GenerateTerrainBuilderOptions : MapOptionsBase
{
[Option('t', "target", Required = true, HelpText = "Target directory")]
public string TargetDirectory { get; set; } = string.Empty;
}
}
12 changes: 11 additions & 1 deletion GameRealisticMap.Arma3.CommandLine/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ static async Task<int> Main(string[] args)
{
try
{
return await Parser.Default.ParseArguments<GenerateObjectLayerOptions, GenerateWrpOptions, GenerateModOptions>(args)
return await Parser.Default.ParseArguments<GenerateObjectLayerOptions, GenerateWrpOptions, GenerateModOptions, GenerateTerrainBuilderOptions>(args)
.MapResult(
(GenerateObjectLayerOptions opts) => GenerateObjectLayer(opts),
(GenerateWrpOptions opts) => GenerateWrp(opts),
(GenerateModOptions opts) => GenerateMod(opts),
(GenerateTerrainBuilderOptions opts) => GenerateTerrainBuilder(opts),
errs => Task.FromResult(1));
}
catch (Exception ex)
Expand All @@ -24,6 +25,15 @@ static async Task<int> Main(string[] args)
}
}

private static async Task<int> GenerateTerrainBuilder(GenerateTerrainBuilderOptions opts)
{
using var workspace = await opts.CreateWorkspace();
var generator = new Arma3TerrainBuilderGenerator(workspace.Assets, workspace.ProjectDrive);
Directory.CreateDirectory(opts.TargetDirectory);
await generator.GenerateTerrainBuilderFiles(workspace.Progress, workspace.MapConfig, opts.TargetDirectory);
return 0;
}

private static async Task<int> GenerateObjectLayer(GenerateObjectLayerOptions opts)
{
using var workspace = await opts.CreateWorkspace();
Expand Down
4 changes: 4 additions & 0 deletions GameRealisticMap.Arma3/GameEngine/DependencyUnpacker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ private List<string> GetRequiredFiles(IEnumerable<string> usedModels)

private void UnpackFiles(IProgressTask progress, IReadOnlyCollection<string> files)
{
if (!OperatingSystem.IsWindows())
{
return; // Unsupported on Linux
}
using var report = progress.CreateStep("UnpackFiles", files.Count);
foreach (var model in files)
{
Expand Down
4 changes: 0 additions & 4 deletions GameRealisticMap.Arma3/IO/ProjectDrive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ private string ToRelativePhysicalPath(string gamePath)

public bool EnsureLocalFileCopy(string path)
{
if (!OperatingSystem.IsWindows())
{
return true; // Unsupported on Linux
}
var fullPath = GetFullPath(path);
if (File.Exists(fullPath))
{
Expand Down

0 comments on commit 764dc49

Please sign in to comment.