// // Copyright 2000 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wWorkspacePane: // Gets the client root value for use in the workspace command #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wPane.h" #include "p4wWorkspacePane.h" p4wWorkspacePane::p4wWorkspacePane( p4wView & ParentView, p4wRequest & Request ) : p4wPane(ParentView, Request) { } p4wWorkspacePane::~p4wWorkspacePane() { } void p4wWorkspacePane::RenderInfo( char *data, char level ) { // // Parse the "Client root" field from p4 info // to get the workspace root value if( !strstr( data, "Client root" ) ) return; // // This data string has the Client root field, so // get it StrBuf root; char *val = strchr( data, ':' ) + 2; int length = strlen( val ); root.Set( val, length ); // // Massage the root string into a form usable for // the workspace root setWorkspaceRoot( root.Text() ); } void p4wWorkspacePane::Render( StrDict *varList ) { // // Server protocol 17+ will send data here StrPtr *clientRoot = varList->GetVar( "clientRoot" ); if( !clientRoot ) return; // // Generate the workspace root from the client root setWorkspaceRoot( clientRoot->Text() ); } void p4wWorkspacePane::setWorkspaceRoot( const char *clientRoot ) { // // Normalize the value of the client root for use // as the workspace root // // Workspace mode cannot be invoked if client // root is null if( !StrPtr::CCompare( clientRoot, "null" ) ) return; // // Get the OS-dependent path delimiter char pd; p4wURL urlMaker; (void)urlMaker.GetSysDirDelim( &pd ); // // If root is enclosed in quotes strip them out int len = strlen( clientRoot ); if( *clientRoot == '"' && ( *( clientRoot + len - 1 ) == '"' ) ) fRoot.Set( clientRoot + 1, len - 2 ); else fRoot.Set( clientRoot ); // // Insure the workspace root is terminated with the // path delimiter if( *( fRoot.Text() + fRoot.Length() - 1 ) != pd ) fRoot << urlMaker.GetSysDirDelim( NULL ); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 12234 | Matt Attaway |
Rejigger P4Web project in preparation for official sunsetting The bin directory contains the last official builds of P4Web from the Perforce download site. P4Web is soon to be completely sunsetted; these builds are here for folks who don't want to build their own. To better handle the archived builds the source code has been moved into a separate src directory. |
||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |