private static MacScalarService CreateMacService(JsonTracer tracer, string[] args) { string serviceName = args.FirstOrDefault(arg => arg.StartsWith(MacScalarService.ServiceNameArgPrefix, StringComparison.OrdinalIgnoreCase)); if (serviceName != null) { serviceName = serviceName.Substring(MacScalarService.ServiceNameArgPrefix.Length); } else { serviceName = ScalarConstants.Service.ServiceName; } ScalarPlatform scalarPlatform = ScalarPlatform.Instance; string logFilePath = ScalarPlatform.Instance.GetLogsDirectoryForGVFSComponent(serviceName); Directory.CreateDirectory(logFilePath); tracer.AddLogFileEventListener( ScalarEnlistment.GetNewScalarLogFileName(logFilePath, ScalarConstants.LogFileTypes.Service), EventLevel.Informational, Keywords.Any); string repoRegistryLocation = scalarPlatform.GetCommonAppDataRootForScalarComponent(ScalarConstants.RepoRegistry.RegistryDirectoryName); ScalarRepoRegistry repoRegistry = new ScalarRepoRegistry( tracer, new PhysicalFileSystem(), repoRegistryLocation); return(new MacScalarService(tracer, serviceName, repoRegistry)); }
public static void Initialize() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { ScalarPlatform.Register(new WindowsPlatform()); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { ScalarPlatform.Register(new MacPlatform()); } else { throw new NotImplementedException(); } }
public void SetUp() { ScalarPlatform.Register(new MockPlatform()); }