34 lines
No EOL
1.1 KiB
C#
34 lines
No EOL
1.1 KiB
C#
using System;
|
|
using Plume.Perforce.Service.Api;
|
|
|
|
namespace Orbit.AfterEffects.Helpers
|
|
{
|
|
// TODO: quick and dirty way to handle our unstable P4 service. I'm not pround of this but Orbit has to ship
|
|
public static class PerforceWorkaround
|
|
{
|
|
public static bool CurrentStreamIsValid(this IPerforceService perforceService, string expectedStream)
|
|
{
|
|
string stream = perforceService.CurrentClient?.Stream;
|
|
if (string.IsNullOrEmpty(stream))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return stream == expectedStream;
|
|
}
|
|
|
|
public static bool EngineDataRootMatchesCurrentStream(this IPerforceService perforceService)
|
|
{
|
|
try
|
|
{
|
|
string currentStreamRoot = perforceService.CurrentClient.Root.ToLowerInvariant().Replace('/', '\\');
|
|
string dataRoot = JD.Core.DataRoot.Value.ToLowerInvariant().Replace('/', '\\');
|
|
return dataRoot.StartsWith(currentStreamRoot);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} |