コード例 #1
0
bool FileAttributesDlg( NCDialogParent* Parent, PanelWin* Panel )
{
	clFileAttributesWin Dialog( Parent, Panel );

	if ( Dialog.DoModal( ) == CMD_OK )
	{
		FSNode* Node = Dialog.GetNode();

		// apply changes
		if ( Node )
		{
			FSPath fspath;
			FSString URI = Dialog.GetURI();
			clPtr<FS> fs = ParzeURI( URI.GetUnicode(), fspath, {} );
			if ( fs )
			{
				int Err = 0;
				FSCInfo Info;
				fs->StatSetAttr( fspath, &Node->st, &Err, &Info );
				if ( Err != 0 )
				{
					throw_msg( "Error setting file attributes: %s", fs->StrError( Err ).GetUtf8() );
				}
				fs->SetFileTime( fspath, Node->GetCreationTime(), Node->GetLastAccessTime(), Node->GetLastWriteTime(), &Err, &Info );
				if ( Err != 0 )
				{
					throw_msg("Error setting file date & time: %s", fs->StrError(Err).GetUtf8());
				}
			}
		}

		return true;
	}

	return false;
}