Fix GAME prefix not DAT prefix

This commit is contained in:
Matt Nadareski
2016-04-20 17:45:39 -07:00
parent 4755345f70
commit 07ce694ae3
3 changed files with 22 additions and 31 deletions

View File

@@ -139,10 +139,10 @@ namespace SabreTools.Helper
/// <param name="quotes">True if quotes should be put around the item, false otherwise (default)</param>
/// <param name="addext">Arbitrary extension added to the end of each item</param>
/// <param name="repext">Arbitrary extension to replace all extensions in the item</param>
/// <param name="datname">The internal name of the DAT to prefix</param>
/// <param name="gamename">True if the game name is appended (only when !usegame), false otherwise</param>
/// <returns>True if the file was written, false otherwise</returns>
public static bool WriteToText(string textfile, string outdir, List<RomData> roms, Logger logger, bool useGame = true, string prefix = "",
string postfix = "", string addext = "", string repext = "", bool quotes = false, string datname = "")
string postfix = "", string addext = "", string repext = "", bool quotes = false, bool gamename = false)
{
// Normalize the output directory
if (outdir == "")
@@ -154,12 +154,6 @@ namespace SabreTools.Helper
outdir += Path.DirectorySeparatorChar;
}
// Get the DAT name, if applicable
if (datname != "" && !datname.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
datname = datname + Path.DirectorySeparatorChar;
}
// Make the output directory if it doesn't exist
if (!Directory.Exists(outdir))
{
@@ -182,7 +176,7 @@ namespace SabreTools.Helper
{
string pre = prefix + (quotes ? "\"" : "");
string post = (quotes ? "\"" : "") + postfix;
string name = datname + (useGame ? rom.Game : rom.Name);
string name = (useGame ? rom.Game : rom.Name);
if (repext != "")
{
string dir = Path.GetDirectoryName(name);
@@ -194,6 +188,10 @@ namespace SabreTools.Helper
{
name += addext;
}
if (!useGame && gamename)
{
name = (rom.Game.EndsWith(Path.DirectorySeparatorChar.ToString()) ? rom.Game : rom.Game + Path.DirectorySeparatorChar) + name;
}
if (useGame && rom.Game != lastgame)
{