TAStudio: use path.combine now, as well as fix a usage of '\' for filename display in .bk2

This commit is contained in:
alyosha-tas 2020-07-04 19:07:38 -04:00
parent e215f99f74
commit 34f99922cd
2 changed files with 5 additions and 3 deletions

View File

@ -304,7 +304,9 @@ namespace BizHawk.Client.Common
int fileSuffix = 0;
while (File.Exists(newFileName))
{
newFileName = $"{Path.GetDirectoryName(oldFileName)}/{Path.GetFileNameWithoutExtension(oldFileName)} {++fileSuffix}.{TasMovie.Extension}";
// Using this should hopefully be system agnostic
var temp_path = Path.Combine(Path.GetDirectoryName(oldFileName), Path.GetFileNameWithoutExtension(oldFileName));
newFileName = $"{temp_path} {++fileSuffix}.{TasMovie.Extension}";
}
return newFileName;

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores;
@ -48,8 +49,7 @@ namespace BizHawk.Client.Common
set
{
_filename = value;
int index = Filename.LastIndexOf("\\");
Name = Filename.Substring(index + 1, Filename.Length - index - 1);
Name = Path.GetFileName(Filename);
}
}