// // Used for building path's such as DFPATH // // This helps us in avoiding duplicate paths getting inserted // Makes adding a path to a set of paths more consistent // Use vWin32fh.pkg Class cSearchPath is a Array Procedure Construct_Object Forward send Construct_Object Property Boolean pbHideRightMostSlash True // Do not show the end slash on the end result End_Procedure // Construct_Object //Doc/ Interface=Public Function FindPath String sPath Returns Integer Integer ndx retVal ArrMax String ArrVal Get vFolderFormat sPath To sPath // paths must end with a "\" char Get item_count to ArrMax move -1 to retVal move 0 to ndx while (ndx < ArrMax AND retVal = -1) Get array_value item ndx to ArrVal // In windows paths are case insensitive If (lowercase(ArrVal) eq lowercase(sPath)) move ndx to retVal Move (ndx + 1) to ndx Loop Function_Return retVal End_function // FindPath Function AddPathItem String sPath Returns Integer Integer iIndex Get FindPath sPath To iIndex If (iIndex < 0) Begin Get Item_Count to iIndex Get vFolderFormat sPath To sPath Set Array_Value item iIndex to sPath End Function_Return iIndex End_Function // AddPathItem //Doc/ Interface=Public // A path may contain multiple folders at any time. Procedure AddPath String sPath Returns Integer Integer iIndex String sPathItem If (Pos(";",sPath)<>0) Begin If (Right(sPath,1)<>";") Begin Move (sPath+";") To sPath End While (Pos(";",sPath)<>0) Move (Left(sPath,Pos(";",sPath)-1)) To sPathItem Get AddPathItem sPathItem To iIndex Move (Replace(sPathItem+";",sPath,"")) To sPath Loop End Else Begin Get AddPathItem sPath To iIndex End End_Procedure // AddPath //Doc/ Interface=Public Procedure RemovePath string sPath Integer iIndex Get FindPath sPath to iIndex If (iIndex > -1) Send delete_item iIndex End_procedure // RemovePath Function Path Returns String String sPath String sValue Integer iIndex Integer iCount Move "" To sPath Get Item_Count To iCount For iIndex From 0 To (iCount-1) Get Value Item iIndex To sValue If (pbHideRightMostSlash(Self)) Begin // Looks better when print out to enduser If (Right(sValue,1)="\") Begin Move (Left(sValue,Length(sValue)-1)) To sValue End End Move (sPath+sValue+";") To sPath Loop Function_Return sPath End_Function // Path End_Class // cSearchPath