Client LuaCsForBarotrauma
ServerExecutableFile.cs
1 using System;
2 using Barotrauma.IO;
3 
4 namespace Barotrauma
5 {
7  {
8  //This content type doesn't do very much on its own, it's handled manually by the Host Server menu
9  public ServerExecutableFile(ContentPackage contentPackage, ContentPath path) : base(contentPackage, path) { }
10 
12  {
13  if (File.Exists(path.FullPath)) { return path; }
14 
15  string rawValueWithoutExtension()
16  => Barotrauma.IO.Path.Combine(
17  Barotrauma.IO.Path.GetDirectoryName(path.RawValue ?? ""),
18  Barotrauma.IO.Path.GetFileNameWithoutExtension(path.RawValue ?? "")).CleanUpPath();
19 
20  path = ContentPath.FromRaw(path.ContentPackage, rawValueWithoutExtension());
21  if (File.Exists(path.FullPath)) { return path; }
22 
24  rawValueWithoutExtension() + ".exe");
25  return path;
26  }
27  }
28 }
readonly? ContentPackage ContentPackage
Definition: ContentPath.cs:21
readonly? string RawValue
Definition: ContentPath.cs:19
static ContentPath FromRaw(string? rawValue)
static ContentPath MutateContentPath(ContentPath path)
ServerExecutableFile(ContentPackage contentPackage, ContentPath path)