ServerHelperApi::InitLocalServer(ClientUser*,Error*)

Creates the personal server based on configured settings.

Virtual?

No

 

Class

ServerHelperApi

 

Arguments

ClientUser *ui

a ClientUser object

 

Error *e

an Error object

Returns

int

returns the p4d return value; 0 indicates success

Notes

This method does the work of creating the personal server using the settings that have been previously set on the ServerHelperApi object. As part of creating the personal server it writes the P4CONFIG and P4IGNORE files, creates the .p4root dir, sets the case sensitivity and Unicode flags, creates the requisite serverId and server spec, and generates a protect table to restrict access to localhost.

If you are cloning from an existing shared server you will need to follow your call to InitLocalServer() with a call to CloneFromRemote(). InitLocalServer() only creates the personal server, it does not populate it.

Example

ClientUser ui;
Error e;
ServerHelperApi server( &e );

if( e.Test() )
    return 0;

server.SetDvcsDir( "/path/to/dvcs" );
server.SetProg( "MyApp" ); // optional
server.SetVersion( "version" ); // optional

if( server.Exists() )
    return 0;

// The unicode and case-sensitivity options must be set _before_
// InitLocalServer() is called. These can be set manually or
// discovered.

server.SetUnicode( true );
server.SetCaseSensitivity( "-C0" );

if( !server.InitLocalServer( &ui ) )
    return 0;