mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Mono doesn't like empty directories
This commit is contained in:
@@ -80,9 +80,11 @@ namespace SabreTools
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure that the path provided is real
|
||||
|
||||
// Read in the roms from the DAT and then write them to the file
|
||||
Output.WriteToText(Path.GetDirectoryName(input) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(input) + "-miss.txt",
|
||||
RomManipulation.Parse(input, 0, 0, logger), logger, usegame, prefix, postfix);
|
||||
Path.GetDirectoryName(input), RomManipulation.Parse(input, 0, 0, logger), logger, usegame, prefix, postfix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,19 +130,36 @@ namespace SabreTools.Helper
|
||||
/// Output a list of roms as a text file with an arbitrary prefix and postfix
|
||||
/// </summary>
|
||||
/// <param name="textfile">Name of the output file</param>
|
||||
/// <param name="outdir">Output directory for the miss file</param>
|
||||
/// <param name="roms">List of RomData objects representing the roms to be output</param>
|
||||
/// <param name="logger">Logger object for console and/or file output</param>
|
||||
/// <param name="useGame">True if only games are written to text file (default), false for files only</param>
|
||||
/// <param name="prefix">Arbitrary string to prefix each line</param>
|
||||
/// <param name="postfix">Arbitrary string to postfix each line</param>
|
||||
/// <returns>True if the file was written, false otherwise</returns>
|
||||
public static bool WriteToText(string textfile, List<RomData> roms, Logger logger, bool useGame = true, string prefix = "", string postfix = "")
|
||||
public static bool WriteToText(string textfile, string outdir, List<RomData> roms, Logger logger, bool useGame = true, string prefix = "", string postfix = "")
|
||||
{
|
||||
logger.Log("Opening file for writing: " + textfile);
|
||||
// Normalize the output directory
|
||||
if (outdir == "")
|
||||
{
|
||||
outdir = Environment.CurrentDirectory;
|
||||
}
|
||||
if (!outdir.EndsWith(Path.DirectorySeparatorChar.ToString()))
|
||||
{
|
||||
outdir += Path.DirectorySeparatorChar;
|
||||
}
|
||||
|
||||
// Make the output directory if it doesn't exist
|
||||
if (!Directory.Exists(outdir))
|
||||
{
|
||||
Directory.CreateDirectory(outdir);
|
||||
}
|
||||
|
||||
logger.Log("Opening file for writing: " + outdir + textfile);
|
||||
|
||||
try
|
||||
{
|
||||
FileStream fs = File.Create(textfile);
|
||||
FileStream fs = File.Create(outdir + textfile);
|
||||
StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
|
||||
|
||||
string lastgame = "";
|
||||
|
||||
Reference in New Issue
Block a user