Ejemplo n.º 1
0
Archivo: CDoc.cpp Proyecto: diversys/pe
void CDoc::SaveRequested(entry_ref& directory, const char *name)
{
	try
	{
		BDirectory dir(&directory);
		gCWD = dir;

		BEntry e(&dir, name);
		FailOSErr(e.InitCheck());
		if (e.Exists())
		{
			entry_ref xr;

			e.GetRef(&xr);

			if (EntryRef() && xr == *EntryRef())	// its me, help!!!
			{
				BFile file;
				FailOSErr(file.SetTo(EntryRef(), B_READ_WRITE));
				FailOSErr(file.SetSize(0));
			}
			else
				e.Remove();
		}

		fReadOnly = false;

		entry_ref eref;
		FailOSErr(e.GetRef(&eref));
		fDocIO->SetEntryRef(&eref);

		if (!IsDirty())
			SetDirty(true);

		Save();
		NameChanged();

		if (EntryRef())
		{
			BPath p;
			FailOSErr(e.GetPath(&p));
			AddRecent(p.Path());
		}

		if (fSavePanel)
		{
			delete fSavePanel;
			fSavePanel = NULL;
		}
	}
	catch (HErr& e)
	{
		e.DoError();
	}
}
Ejemplo n.º 2
0
void PProjectWindow::NameChanged()
{
	inherited::NameChanged();
	if (EntryRef())
	{
		BEntry e;
		BPath p;
		FailOSErr(e.SetTo(EntryRef()));
		FailOSErr(e.GetPath(&p));
		fStatus->SetPath(p.Path());
		AddRecent(p.Path());
	}
}