Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2025.2

# ServerHelperApi::PrepareToCloneFilepath(ServerHelperApi*,const char*,ClientUser*,Error*)

Creates a remote specification based on the provided filepath.

Virtual? | No |
Class | `ServerHelperApi` |
Arguments | `ServerHelperApi *remote` | ServerHelperApi object representing the shared server
| `const char *path` | depot path to clone
| `Error *e` | an Error object
Returns | `int` | returns 1 if successful

## Notes

This creates a new remote spec based on the provided filepath. It also checks that `p4 fetch` is allowed on the remote server specified.

## See also

`ServerHelperApi::PrepareToCloneRemote()`

## Example

    ServerHelperApi remoteServer( &e );
    remoteServer.SetPort( "1666" );
    remoteServer.SetProg( "MyApp" ); // optional
    remoteServer.SetVersion( "1.0" ); // optional

    // Generate the remote spec
    if( !localServer.PrepareToCloneFilepath( &remoteServer, path, &ui ) )
        return 0;

    // Create the local server
    // This returns the exit code from p4d, so 0 is success
    if( localServer.InitLocalServer( &ui ) )
        return 0;

    // Fetch from the remote
    if( !localServer.CloneFromRemote( 0, 0, &ui ) )
        return 0;

Your search for returned results