#
#	File:		P4GetCurrentRoot
#
#	Contains:	Script to return the Root path from the current P4
#				client settings. 
#
#	Version:	
#
#	Copyright:	� 1999 by Apple Computer, Inc., all rights reserved.
#
#	File Ownership:
#
#		DRI:				Andy Bachorski
#
#		Other Contact:		xxx put other contact here xxx
#
#		Technology:			Perforce p4
#
#	Writers:
#
#		(afb)	Andy Bachorski
#
#	Change History (most recent first):
#
#		<0+>	11/16/99	afb		First checked in.
#
#
#	Usage
#		P4GetCurrentRoot [file]
#			file	location of a file contining the output from 
#					a p4 client command.  If not provides, a query
#					will be sent to the current p4 server to get
#					the needed info.

	Set Exit 0
	
	if "{1}" == ""
		Set delete_file_ 1
		Set info_file_ "{TempFolder}client_info_"
		
		p4 client -o > "{info_file_}"
	else
		Set delete_file_ 0
		Set info_file_ "{1}"
	end
	
	Open "{info_file_}" -h			#	open the file list hidden
	Find � "{info_file_}"			#	Go to the beginning of the file
	Find /�View:�/!1�:!200�1 "{info_file_}"
	
	Set view_file_ "{TempFolder}views_file"
	Catenate "{info_file_}.�" > "{view_file_}"
	
	Close "{info_file_}"
	if {delete_file_}
		Delete "{info_file_}"
	end
	
	echo "{view_file_}"