示例#1
0
Bool AssertPathExists(const Filename &fn)
{
	if (GeFExist(fn, true))
		return true;

	CFilenameArray pfnDir;
	Filename fnDir = fn;
	Bool bRet = false;
	Int32 a;
	Filename** ppfn;

	while (!GeFExist(fnDir, true))
	{
		Filename* pfn = pfnDir.InsertAt(0);
		if (!pfn)
			goto _error;
		*pfn = fnDir.GetFile();
		fnDir = fnDir.GetDirectory();
		if (!fnDir.Content())
		{
			return false;
		}
	}

	ppfn = pfnDir.GetArray()->GetArray();
	for (a = 0; a < pfnDir.GetElementCount(); a++)
	{
		fnDir += fnDir + *(ppfn[a]);
		if (GeFExist(fnDir, true))
			continue;
		if (!GeFCreateDir(fnDir))
			goto _error;
	}

	bRet = true;
_error:
	return bRet;
}
示例#2
0
CCompareTableDialog::CCompareTableDialog(Filename fnOriginal, Filename fnNew)
{
	fnOriginal.SetSuffix("");
	fnNew.SetSuffix("");

	String str;
	str = fnNew.GetString();
	fnNew = Filename(str.SubStr(0, str.GetLength() - 1));

	str = fnOriginal.GetString();
	fnOriginal = Filename(str.SubStr(0, str.GetLength() - 1));

	String strOriginalFileString = fnOriginal.GetFileString();
	String strNewFileString = fnNew.GetFileString();

	Filename fn;

	Bool bOriginalDiag = false, bNewDiag = false;

	fn = fnOriginal.GetDirectory(); // fn contains strings_* or dialogs
	if (fn.GetFileString().LexCompare("dialogs") == 0)
	{
		fn = fn.GetDirectory(); // now, we are in the strings_* path
		bOriginalDiag = true;
	}
	fn = fn.GetDirectory();
	fnOriginal = fn;

	fn = fnNew.GetDirectory(); // fn contains strings_* or dialogs
	if (fn.GetFileString().LexCompare("dialogs") == 0)
	{
		fn = fn.GetDirectory(); // now, we are in the strings_* path
		bNewDiag = true;
	}
	fn = fn.GetDirectory();
	fnNew = fn;

	TRACE_STRING(fnOriginal.GetString());
	TRACE_STRING(fnNew.GetString());

	m_OriginalDoc.LoadGlobalStringTable(fnOriginal, strOriginalFileString);
	m_NewDoc.LoadGlobalStringTable(fnNew, strNewFileString);

	TRACE_STRING(fnNew.GetDirectory().GetFileString());

	m_pOriginalTable = m_OriginalDoc.GetStringTable();
	m_pNewTable = m_NewDoc.GetStringTable();

	if (bOriginalDiag)
		m_fnOriginal = fnOriginal + String("strings_*") + String("dialogs") + (strOriginalFileString + ".str");
	else
		m_fnOriginal = fnOriginal + String("strings_*") + (strOriginalFileString + ".str");

	if (bNewDiag)
		m_fnNew = fnNew + String("strings_*") + String("dialogs") + (strNewFileString + ".str");
	else
		m_fnNew = fnNew + String("strings_*") + (strNewFileString + ".str");

	//TRACE_STRING(m_fnNew.GetString());
	//TRACE_STRING(m_fnOriginal.GetString());

	m_bIsCommandTable = (m_OriginalDoc.m_StringTableType == typeCommandStrings) &&
											(m_NewDoc.m_StringTableType == typeCommandStrings);
}
示例#3
0
void AddFilename(Filename &fn, const Filename fnDest)
{
	if (!fnDest.Content())
		return;
	AddFilename1(fn, fnDest.GetDirectory(), fnDest.GetFile());
}
示例#4
0
void AddFilename1(Filename &fn, const Filename fnDir, const Filename fnFile)
{
	if (fnDir.Content())
		AddFilename1(fn, fnDir.GetDirectory(), fnDir.GetFile());
	fn += fnFile;
}