private static string GetPath(int transformerId, string name, IndexingConfiguration configuration) { var path = Path.Combine(configuration.IndexStoragePath, "Transformers", $"{transformerId}.{Convert.ToBase64String(Encoding.UTF8.GetBytes(name))}{FileExtension}"); if (PlatformDetails.RunningOnPosix) { path = PosixHelper.FixLinuxPath(path); } return(path); }
private void InitializePath(string path) { if (PlatformDetails.RunningOnPosix) { path = PosixHelper.FixLinuxPath(path); } if (Directory.Exists(path) == false && _documentDatabase.Configuration.Indexing.RunInMemory == false) { Directory.CreateDirectory(path); } }
public override unsafe void WriteHeader(string filename, FileHeader *header) { var path = Path.Combine(_basePath, filename); if (RunningOnPosix) { PosixHelper.WriteFileHeader(header, path); } else { Win32Helper.WriteFileHeader(header, path); } }
public unsafe override bool ReadHeader(string filename, FileHeader *header) { var path = Path.Combine(_basePath, filename); if (File.Exists(path) == false) { return(false); } if (RunningOnPosix) { return(PosixHelper.TryReadFileHeader(header, path)); } return(Win32Helper.TryReadFileHeader(header, path)); }
protected string NewDataPath([CallerMemberName] string caller = null) { var path = $".\\Databases\\{caller ?? "TestPath"}.{Interlocked.Increment(ref _pathCount)}"; if (PosixHelper.RunningOnPosix) { path = PosixHelper.FixLinuxPath(path); } path = Path.GetFullPath(path); _localPathsToDelete.Add(path); return(path); }
public static string NewDataPath(string testName, int serverPort, bool forceCreateDir = false) { testName = testName?.Replace("<", "").Replace(">", ""); var newDataDir = Path.GetFullPath($".\\Databases\\{testName ?? "TestDatabase"}_{serverPort}-{DateTime.Now:yyyy-MM-dd-HH-mm-ss-fff}-{Interlocked.Increment(ref _pathCount)}"); if (PlatformDetails.RunningOnPosix) { newDataDir = PosixHelper.FixLinuxPath(newDataDir); } if (forceCreateDir && Directory.Exists(newDataDir) == false) { Directory.CreateDirectory(newDataDir); } return(newDataDir); }
public override unsafe bool ReadHeader(string filename, FileHeader *header) { var path = _basePath.Combine(filename); if (File.Exists(path.FullPath) == false) { return(false); } var success = RunningOnPosix ? PosixHelper.TryReadFileHeader(header, path) : Win32Helper.TryReadFileHeader(header, path); if (!success) { return(false); } return(header->Hash == HeaderAccessor.CalculateFileHeaderHash(header)); }
private static string GetServerPath() { var prefix = PosixHelper.RunningOnPosix ? "file://" : "file:///"; #pragma warning disable SYSLIB0012 // Type or member is obsolete var testAssemblyLocation = typeof(RavenTestDriver).Assembly.CodeBase; #pragma warning restore SYSLIB0012 // Type or member is obsolete if (testAssemblyLocation.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) { testAssemblyLocation = testAssemblyLocation.Substring(prefix.Length); } var testDllFile = new FileInfo(testAssemblyLocation); if (testDllFile.Exists == false) { throw new InvalidOperationException($"Could not find '{testDllFile.FullName}'."); } #if DEBUG var serverDirectory = @"../../../../../src/Raven.Server/bin/x64/Debug/net5.0"; if (Directory.Exists(serverDirectory) == false) // this can happen when running directly from CLI e.g. dotnet xunit { serverDirectory = @"../../../../../src/Raven.Server/bin/Debug/net5.0"; } #else var serverDirectory = @"../../../../../src/Raven.Server/bin/x64/Release/net5.0"; if (Directory.Exists(serverDirectory) == false) // this can happen when running directly from CLI e.g. dotnet xunit { serverDirectory = @"../../../../../src/Raven.Server/bin/Release/net5.0"; } #endif var path = Path.Combine(testDllFile.DirectoryName, serverDirectory); if (PosixHelper.RunningOnPosix) { path = PosixHelper.FixLinuxPath(path); } return(Path.GetFullPath(path)); }