Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determine Components Not Is Use
Message
From
31/01/2008 13:36:36
 
General information
Forum:
Visual FoxPro
Category:
Project manager
Miscellaneous
Thread ID:
01287579
Message ID:
01287601
Views:
20
>I have inherited a large, old VFP 9 project. There are 800+ components in the project. Is there an efficient way
>to determine which components are not being used?

As Naomi said, create a new project and add the main program, the Build Project. Then, you can use code like this to get a list of the differences. You do have to go through the list to see whether a file is really unused or just referenced only indirectly.
*==============================================================================
* Program:				LISTMISSINGFILES.PRG
* Purpose:				Make a list of files in one project that aren't in another
* From:				    Practical Tips for Working with Existing Code
* Copyright:			(c) 2007 Tamar E. Granor, Ph.D.
* Last revision:		03/21/07
*==============================================================================

LPARAMETERS cOldProject, cNewProject

LOCAL oOld as VisualFoxpro.IFoxProject, oNew as VisualFoxpro.IFoxProject

MODIFY PROJECT (m.cOldProject) NOWAIT 
oOld = _VFP.ActiveProject

MODIFY PROJECT (m.cNewProject) NOWAIT 
oNew = _VFP.ActiveProject

CREATE CURSOR Missing (mFile M)

LOCAL oFile, oNewFile, cFileName

FOR EACH oFile IN oOld.Files
	* Look for each file from the old project in the new project.
	* The filename without path is the key in the collection.
	cFileName = JUSTFNAME(oFile.Name)
	
	TRY
		oNewFile = oNew.Files[m.cFileName]
		
	CATCH  
		* Used in old, not in new
		INSERT INTO Missing VALUES (oFile.Name)
		
	ENDTRY
ENDFOR
Previous
Reply
Map
View

Click here to load this message in the networking platform