Holy cow, that would make it much faster!
Copy ini to folder with new name
Open it
Append [Root]
Close it
Yeah. That would definitely be faster than copy the contents.
I should have tried putting [Root] at the end first, it just didn't seem to make sense that it would work.
UPDATE TO PREVIOUS CODE:
function CreateTCCompatibleINI(sourceINI,targetINI)
{
var didCopy;
//Deletes the ini file if it exists
aqFile.Delete(targetINI);
//-------------------------------------------------
// Copy source ini to target folder
if (aqFile.Exists(sourceINI))
{
didCopy = aqFile.Copy(sourceINI,targetINI, false);
}
else
{
Log.Error("Cannot find " + sourceINI);
}
//-------------------------------------------------
// Opens targetINI for writing
if (didCopy)
{
var targetINIFile = aqFile.OpenTextFile(targetINI, aqFile.faWrite, aqFile.ctANSI);
//Writes root to the bottom of the ini file for TC compatibility.
targetINIFile.WriteLine("[Root]");
}
else
{
Log.Error(sourceINI + " did not copy to " + targetINI);
}
//-------------------------------------------
//Closes files so they can be manipulated again.
targetINIFile.Close();
}
Way faster!