Skip to content

Commit eeffa58

Browse files
committed
Simplify path handling in the console app
1 parent d45e129 commit eeffa58

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

AssetRipper.TextureDecoder.ConsoleApp/Program.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,37 +58,34 @@ static void Main(string[] args)
5858
throw new NotSupportedException(inputType);
5959
}
6060

61-
string dirPath = Path.GetDirectoryName(path) ?? Environment.CurrentDirectory;
62-
string name = Path.GetFileName(path);
63-
6461
switch (outputType)
6562
{
6663
case "bgra":
67-
WriteAllBytes(Path.Combine(dirPath, name + ".bgra"), bitmap.Bits);
64+
WriteAllBytes(path + ".bgra", bitmap.Bits);
6865
break;
6966
case "bmp":
7067
bitmap.FlipY();
71-
bitmap.SaveAsBmp(Path.Combine(dirPath, name + ".bmp"));
68+
bitmap.SaveAsBmp(path + ".bmp");
7269
break;
7370
case "exr":
7471
bitmap.FlipY();
75-
bitmap.SaveAsExr(Path.Combine(dirPath, name + ".exr"));
72+
bitmap.SaveAsExr(path + ".exr");
7673
break;
7774
case "hdr":
7875
bitmap.FlipY();
79-
bitmap.SaveAsHdr(Path.Combine(dirPath, name + ".hdr"));
76+
bitmap.SaveAsHdr(path + ".hdr");
8077
break;
8178
case "jpg":
8279
bitmap.FlipY();
83-
bitmap.SaveAsJpg(Path.Combine(dirPath, name + ".jpg"));
80+
bitmap.SaveAsJpg(path + ".jpg");
8481
break;
8582
case "png":
8683
bitmap.FlipY();
87-
bitmap.SaveAsPng(Path.Combine(dirPath, name + ".png"));
84+
bitmap.SaveAsPng(path + ".png");
8885
break;
8986
case "tga":
9087
bitmap.FlipY();
91-
bitmap.SaveAsTga(Path.Combine(dirPath, name + ".tga"));
88+
bitmap.SaveAsTga(path + ".tga");
9289
break;
9390
default:
9491
throw new NotSupportedException(outputType);

0 commit comments

Comments
 (0)