Skip to content

Commit

Permalink
Use forward slashes in file paths (#780)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahm86 authored Oct 24, 2024
1 parent f656124 commit 63b97a6
Show file tree
Hide file tree
Showing 95 changed files with 231 additions and 231 deletions.
8 changes: 4 additions & 4 deletions LocationExport/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ static void Main(string[] args)
_reader1 = new();
_reader2 = new();
_reader3 = new();
_allTR1Exclusions = JsonConvert.DeserializeObject<Dictionary<string, List<Location>>>(File.ReadAllText(@"Resources\TR1\Locations\invalid_item_locations.json"));
_allTR2Exclusions = JsonConvert.DeserializeObject<Dictionary<string, List<Location>>>(File.ReadAllText(@"Resources\TR2\Locations\invalid_item_locations.json"));
_allTR3Exclusions = JsonConvert.DeserializeObject<Dictionary<string, List<Location>>>(File.ReadAllText(@"Resources\TR3\Locations\invalid_item_locations.json"));
_allTR1Exclusions = JsonConvert.DeserializeObject<Dictionary<string, List<Location>>>(File.ReadAllText("Resources/TR1/Locations/invalid_item_locations.json"));
_allTR2Exclusions = JsonConvert.DeserializeObject<Dictionary<string, List<Location>>>(File.ReadAllText("Resources/TR2/Locations/invalid_item_locations.json"));
_allTR3Exclusions = JsonConvert.DeserializeObject<Dictionary<string, List<Location>>>(File.ReadAllText("Resources/TR3/Locations/invalid_item_locations.json"));

if (args[0].ToLower() == "export")
{
Expand Down Expand Up @@ -244,7 +244,7 @@ private static void Adjust(string[] args)
return;
}

var allLocs = JsonConvert.DeserializeObject<Dictionary<string, List<Location>>>(File.ReadAllText($@"Resources\{version}\Locations\locations.json"));
var allLocs = JsonConvert.DeserializeObject<Dictionary<string, List<Location>>>(File.ReadAllText($"Resources/{version}/Locations/locations.json"));
var diff = new Dictionary<string, List<Location>>();
foreach (var (lvl, locs) in allLocs)
{
Expand Down
6 changes: 3 additions & 3 deletions ModelExport/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ static void Main(string[] args)
static void TR1Export()
{
TR1MassExporter exporter = new();
exporter.Export(Directory.GetCurrentDirectory(), @"TR1\Objects");
exporter.Export(Directory.GetCurrentDirectory(), "TR1/Objects");
}

static void TR2Export()
{
TR2MassExporter exporter = new();
exporter.Export(Directory.GetCurrentDirectory(), @"TR2\Objects");
exporter.Export(Directory.GetCurrentDirectory(), "TR2/Objects");
}

static void TR3Export()
{
TR3MassExporter exporter = new();
exporter.Export(Directory.GetCurrentDirectory(), @"TR3\Objects");
exporter.Export(Directory.GetCurrentDirectory(), "TR3/Objects");
}

private static void Usage()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public override void ApplyToLevel(TR1Level level)
{
Level = level,
TypesToImport = new(Models.Select(m => (TR1Type)m)),
DataFolder = @"Resources\TR1\Objects",
DataFolder = "Resources/TR1/Objects",
ForceCinematicOverwrite = ForceCinematicOverwrite
};

Expand All @@ -28,7 +28,7 @@ public override void ApplyToLevel(TR2Level level)
{
Level = level,
TypesToImport = new(Models.Select(m => (TR2Type)m)),
DataFolder = @"Resources\TR2\Objects",
DataFolder = "Resources/TR2/Objects",
ForceCinematicOverwrite = ForceCinematicOverwrite
};

Expand All @@ -42,7 +42,7 @@ public override void ApplyToLevel(TR3Level level)
{
Level = level,
TypesToImport = new(Models.Select(m => (TR3Type)m)),
DataFolder = @"Resources\TR3\Objects",
DataFolder = "Resources/TR3/Objects",
ForceCinematicOverwrite = ForceCinematicOverwrite
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public override void ApplyToLevel(TR1Level level)
Level = level,
ClearUnusedSprites = false,
TypesToImport = new(data.Select(m => (TR1Type)m.ModelID)),
DataFolder = @"Resources\TR1\Objects",
DataFolder = "Resources/TR1/Objects",
IgnoreGraphics = true
};
importer.Import();
Expand All @@ -40,7 +40,7 @@ public override void ApplyToLevel(TR2Level level)
Level = level,
ClearUnusedSprites = false,
TypesToImport = new(data.Select(m => (TR2Type)m.ModelID)),
DataFolder = @"Resources\TR2\Objects",
DataFolder = "Resources/TR2/Objects",
IgnoreGraphics = true
};
importer.Import();
Expand All @@ -61,7 +61,7 @@ public override void ApplyToLevel(TR3Level level)
Level = level,
ClearUnusedSprites = false,
TypesToImport = new(data.Select(m => (TR3Type)m.ModelID)),
DataFolder = @"Resources\TR3\Objects",
DataFolder = "Resources/TR3/Objects",
IgnoreGraphics = true
};
importer.Import();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public abstract class BaseEMRoomImportFunction : BaseEMFunction

protected string ReadRoomResource(string versionID)
{
string path = string.Format(@"Resources\{0}\Rooms\{1}-Rooms.json", versionID, LevelID);
string path = string.Format("Resources/{0}/Rooms/{1}-Rooms.json", versionID, LevelID);
if (!File.Exists(path))
{
throw new IOException("Missing room definition data: " + path);
Expand All @@ -24,7 +24,7 @@ protected string ReadRoomResource(string versionID)

protected string ReadZoningResource(string versionID)
{
string path = string.Format(@"Resources\{0}\Rooms\{1}-Zoning.json", versionID, LevelID);
string path = string.Format("Resources/{0}/Rooms/{1}-Zoning.json", versionID, LevelID);
if (!File.Exists(path))
{
throw new IOException("Missing room zoning data: " + path);
Expand Down
2 changes: 1 addition & 1 deletion TRDataControl/Transport/TRDataTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public abstract class TRDataTransport<L, T, S, B>
where S : Enum
where B : TRBlobBase<T>
{
protected static readonly string _defaultDataFolder = @"Resources\Objects";
protected static readonly string _defaultDataFolder = "Resources/Objects";
protected static readonly string _blobExt = ".TRB";

public IDataProvider<T, S> Data { get; set; }
Expand Down
10 changes: 5 additions & 5 deletions TRDataControlTests/IO/ExportTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void TestTR1ExportIO()
TR1Level level = GetTR1TestLevel();
TR1DataExporter exporter = new()
{
DataFolder = @"Objects\TR1"
DataFolder = "Objects/TR1"
};
TR1Blob blob1 = exporter.Export(level, TR1Type.Bear);
exporter.StoreBlob(blob1);
Expand Down Expand Up @@ -89,7 +89,7 @@ public void TestTR2ExportIO()
TR2Level level = GetTR2TestLevel();
TR2DataExporter exporter = new()
{
DataFolder = @"Objects\TR2"
DataFolder = "Objects/TR2"
};
TR2Blob blob1 = exporter.Export(level, TR2Type.BengalTiger);
exporter.StoreBlob(blob1);
Expand Down Expand Up @@ -137,7 +137,7 @@ public void TestTR3ExportIO()
TR3Level level = GetTR3TestLevel();
TR3DataExporter exporter = new()
{
DataFolder = @"Objects\TR3"
DataFolder = "Objects/TR3"
};
TR3Blob blob1 = exporter.Export(level, TR3Type.Monkey);
exporter.StoreBlob(blob1);
Expand Down Expand Up @@ -179,7 +179,7 @@ public void TestTR4ExportIO()
TR4Level level = GetTR4TestLevel();
TR4DataExporter exporter = new()
{
DataFolder = @"Objects\TR4"
DataFolder = "Objects/TR4"
};
TR4Blob blob1 = exporter.Export(level, TR4Type.Dog);
exporter.StoreBlob(blob1);
Expand Down Expand Up @@ -222,7 +222,7 @@ public void TestTR5ExportIO()
TR5Level level = GetTR5TestLevel();
TR5DataExporter exporter = new()
{
DataFolder = @"Objects\TR5"
DataFolder = "Objects/TR5"
};
TR5Blob blob1 = exporter.Export(level, TR5Type.Huskie);
exporter.StoreBlob(blob1);
Expand Down
34 changes: 17 additions & 17 deletions TRDataControlTests/IO/ImportTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void TestTR1Import()

TR1DataImporter importer = new()
{
DataFolder = @"Objects\TR1",
DataFolder = "Objects/TR1",
Level = level,
TypesToImport = new() { TR1Type.Bear },
};
Expand All @@ -42,7 +42,7 @@ public void TestTR1RMerge()

TR1DataImporter importer = new()
{
DataFolder = @"Objects\TR1",
DataFolder = "Objects/TR1",
Level = level,
TypesToImport = new() { TR1Type.Bear },
TypesToRemove = new() { TR1Type.Larson },
Expand Down Expand Up @@ -83,7 +83,7 @@ public void TestTR2Import()

TR2DataImporter importer = new()
{
DataFolder = @"Objects\TR2",
DataFolder = "Objects/TR2",
Level = level,
TypesToImport = new() { TR2Type.BengalTiger },
};
Expand All @@ -104,7 +104,7 @@ public void TestTR2RMerge()

TR2DataImporter importer = new()
{
DataFolder = @"Objects\TR2",
DataFolder = "Objects/TR2",
Level = level,
TypesToImport = new() { TR2Type.BengalTiger },
TypesToRemove = new() { TR2Type.Yeti },
Expand Down Expand Up @@ -145,7 +145,7 @@ public void TestTR3Import()

TR3DataImporter importer = new()
{
DataFolder = @"Objects\TR3",
DataFolder = "Objects/TR3",
Level = level,
TypesToImport = new() { TR3Type.Monkey },
};
Expand All @@ -166,7 +166,7 @@ public void TestTR3RMerge()

TR3DataImporter importer = new()
{
DataFolder = @"Objects\TR3",
DataFolder = "Objects/TR3",
Level = level,
TypesToImport = new() { TR3Type.Monkey },
TypesToRemove = new() { TR3Type.Dog },
Expand Down Expand Up @@ -207,7 +207,7 @@ public void TestTR4Import()

TR4DataImporter importer = new()
{
DataFolder = @"Objects\TR4",
DataFolder = "Objects/TR4",
Level = level,
TypesToImport = new() { TR4Type.Dog },
};
Expand All @@ -227,7 +227,7 @@ public void TestTR5Import()

TR5DataImporter importer = new()
{
DataFolder = @"Objects\TR5",
DataFolder = "Objects/TR5",
Level = level,
TypesToImport = new() { TR5Type.Huskie },
};
Expand Down Expand Up @@ -264,7 +264,7 @@ public void TestDirectDependency()
TR2Level level = GetTR2AltTestLevel();
TR2DataImporter importer = new()
{
DataFolder = @"Objects\TR2",
DataFolder = "Objects/TR2",
Level = level,
TypesToImport = new() { TR2Type.MaskedGoon2 },
};
Expand All @@ -286,7 +286,7 @@ public void TestDependencyRemoval()
TR2Level level = GetTR2AltTestLevel();
TR2DataImporter importer = new()
{
DataFolder = @"Objects\TR2",
DataFolder = "Objects/TR2",
Level = level,
TypesToImport = new() { TR2Type.MaskedGoon1 },
};
Expand All @@ -295,7 +295,7 @@ public void TestDependencyRemoval()

importer = new()
{
DataFolder = @"Objects\TR2",
DataFolder = "Objects/TR2",
Level = level,
TypesToImport = new() { TR2Type.MaskedGoon2 },
TypesToRemove = new() { TR2Type.MaskedGoon1 },
Expand All @@ -306,7 +306,7 @@ public void TestDependencyRemoval()

importer = new()
{
DataFolder = @"Objects\TR2",
DataFolder = "Objects/TR2",
Level = level,
TypesToImport = new() { TR2Type.BengalTiger },
TypesToRemove = new() { TR2Type.MaskedGoon1, TR2Type.MaskedGoon2 },
Expand All @@ -322,7 +322,7 @@ private static void ExportTR1Model(TR1Type type)
TR1Level level = GetTR1TestLevel();
TR1DataExporter exporter = new()
{
DataFolder = @"Objects\TR1"
DataFolder = "Objects/TR1"
};
TR1Blob blob = exporter.Export(level, type);
exporter.StoreBlob(blob);
Expand All @@ -346,7 +346,7 @@ private static void ExportTR2Model(TR2Type type)
TR2Level level = GetTR2TestLevel();
TR2DataExporter exporter = new()
{
DataFolder = @"Objects\TR2"
DataFolder = "Objects/TR2"
};
TR2Blob blob = exporter.Export(level, type);
exporter.StoreBlob(blob);
Expand All @@ -370,7 +370,7 @@ private static void ExportTR3Model(TR3Type type)
TR3Level level = GetTR3TestLevel();
TR3DataExporter exporter = new()
{
DataFolder = @"Objects\TR3"
DataFolder = "Objects/TR3"
};
TR3Blob blob = exporter.Export(level, type);
exporter.StoreBlob(blob);
Expand All @@ -394,7 +394,7 @@ private static void ExportTR4Model(TR4Type type)
TR4Level level = GetTR4TestLevel();
TR4DataExporter exporter = new()
{
DataFolder = @"Objects\TR4"
DataFolder = "Objects/TR4"
};
TR4Blob blob = exporter.Export(level, type);
exporter.StoreBlob(blob);
Expand All @@ -410,7 +410,7 @@ private static void ExportTR5Model(TR5Type type)
TR5Level level = GetTR5TestLevel();
TR5DataExporter exporter = new()
{
DataFolder = @"Objects\TR5"
DataFolder = "Objects/TR5"
};
TR5Blob blob = exporter.Export(level, type);
exporter.StoreBlob(blob);
Expand Down
2 changes: 1 addition & 1 deletion TRImageControl/Textures/Data/TR1TextureDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ namespace TRImageControl.Textures;
public class TR1TextureDatabase : TextureDatabase<TR1Type>
{
public TR1TextureDatabase()
: base(@"Resources\TR1\Textures\Source") { }
: base("Resources/TR1/Textures/Source") { }
}
2 changes: 1 addition & 1 deletion TRImageControl/Textures/Data/TR2TextureDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ namespace TRImageControl.Textures;
public class TR2TextureDatabase : TextureDatabase<TR2Type>
{
public TR2TextureDatabase()
: base(@"Resources\TR2\Textures\Source") { }
: base("Resources/TR2/Textures/Source") { }
}
2 changes: 1 addition & 1 deletion TRImageControl/Textures/Data/TR3TextureDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ namespace TRImageControl.Textures;
public class TR3TextureDatabase : TextureDatabase<TR3Type>
{
public TR3TextureDatabase()
: base(@"Resources\TR3\Textures\Source") { }
: base("Resources/TR3/Textures/Source") { }
}
10 changes: 5 additions & 5 deletions TRImageControl/Textures/Data/TextureDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace TRImageControl.Textures;
public class TextureDatabase<E>
where E : Enum
{
private static readonly string _entityLookupPath = @"Static\entity_lookup.json";
private static readonly string _dynamicDataPath = @"Dynamic\{0}.json";
private static readonly string _staticDataPath = @"Static\{0}";
private static readonly string _entityLookupPath = "Static/entity_lookup.json";
private static readonly string _dynamicDataPath = "Dynamic/{0}.json";
private static readonly string _staticDataPath = "Static/{0}";
private static readonly string _staticPngFile = "Segments.png";
private static readonly string _staticDataFile = "Data.json";

Expand Down Expand Up @@ -65,7 +65,7 @@ public StaticTextureSource<E>[] GetStaticSource(E entity)

private DynamicTextureSource LoadDynamicSource(string name)
{
string source = Path.Combine(DataPath, string.Format(_dynamicDataPath, name.Replace(".", @"\")));
string source = Path.Combine(DataPath, string.Format(_dynamicDataPath, name.Replace(".", "/")));
if (!File.Exists(source))
{
throw new IOException(string.Format("Missing texture pack source JSON ({0})", source));
Expand All @@ -76,7 +76,7 @@ private DynamicTextureSource LoadDynamicSource(string name)

private StaticTextureSource<E> LoadStaticSource(string name)
{
string dir = Path.Combine(DataPath, string.Format(_staticDataPath, name.Replace(".", @"\")));
string dir = Path.Combine(DataPath, string.Format(_staticDataPath, name.Replace(".", "/")));
if (!Directory.Exists(dir))
{
throw new IOException(string.Format("Missing texture pack source folder ({0})", name));
Expand Down
2 changes: 1 addition & 1 deletion TRImageControl/Textures/Grouping/GlobalGrouping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace TRImageControl.Textures;
public class GlobalGrouping<E>
where E : Enum
{
private static readonly string _groupingDataPath = @"Static\global_grouping.json";
private static readonly string _groupingDataPath = "Static/global_grouping.json";

public Dictionary<StaticTextureSource<E>, List<StaticTextureTarget>> Sources { get; private set; }
public List<TextureGrouping<E>> Grouping { get; private set; }
Expand Down
2 changes: 1 addition & 1 deletion TRImageControl/Textures/Mapping/TR1TextureMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ protected TR1TextureMapping(TR1Level level)

public static TR1TextureMapping Get(TR1Level level, string mappingFilePrefix, TR1TextureDatabase database, Dictionary<StaticTextureSource<TR1Type>, List<StaticTextureTarget>> predefinedMapping = null, List<TR1Type> entitiesToIgnore = null, Dictionary<TR1Type, TR1Type> entityMap = null)
{
string mapFile = Path.Combine(@"Resources\TR1\Textures\Mapping\", mappingFilePrefix + "-Textures.json");
string mapFile = Path.Combine("Resources/TR1/Textures/Mapping/", mappingFilePrefix + "-Textures.json");
if (!File.Exists(mapFile))
{
return null;
Expand Down
Loading

0 comments on commit 63b97a6

Please sign in to comment.