Reputation: 155
Using p4java to sync files on various machines, so I'm using IClient.setRoot() to change the root accordingly. But IClient.setRoot() doesn't actually change the root in the client object.I looked in the debugger right after the setRoot() call
Here's my code after connecting to the server.
client is an IClient and p4Server is an IServer.
the prop functions are simply pulling properties entries for workspace and root dir
What am I missing to make setRoot() work. Thanks!
client = p4Server.getClient(prop.getString("perforce.workspace"));
if (client == null) {
logger.error("Failed to fetch workspace: {}", prop.getString("perforce.workspace"));
} else {
File p4Dir = new File(prop.getPath("perforce.scripts.dest"));
if (!p4Dir.exists()) {
p4Dir.mkdirs();
}
client.setRoot(p4Dir.getPath());
logger.debug("Setting p4sync dest root to: {}",p4Dir.getPath() );
p4Server.setCurrentClient(client);
Upvotes: 0
Views: 141
Reputation: 456
You must update the client on the server - the setCurrentClient() does not do this.
client.setRoot(p4Dir.getPath());
logger.debug("Setting p4sync dest root to: {}",p4Dir.getPath() );
client.update();
p4Server.setCurrentClient(client);
Upvotes: 1