@@ -153,7 +153,7 @@ public async Task<IReadOnlyCollection<ICommittedDomainEvent>> CommitEventsAsync(
153153 {
154154 var eventPath = _filesEventLocator . GetEventPath ( id , serializedEvent . AggregateSequenceNumber ) ;
155155 _globalSequenceNumber ++ ;
156- _eventLog [ _globalSequenceNumber ] = GetRelativePath ( _configuration . StorePath , eventPath ) ;
156+ _eventLog [ _globalSequenceNumber ] = Path . GetRelativePath ( _configuration . StorePath , eventPath ) ;
157157
158158 var fileEventData = new FileEventData
159159 {
@@ -278,45 +278,5 @@ private EventStoreLog RecreateEventStoreLog(string path)
278278 Log = directory ,
279279 } ;
280280 }
281-
282- /// <summary>
283- /// Creates a relative path from one file or folder to another.
284- /// </summary>
285- /// <param name="relativeTo">Contains the directory that defines the start of the relative path.</param>
286- /// <param name="path">Contains the path that defines the endpoint of the relative path.</param>
287- /// <returns>The relative path from the start directory to the end path or <c>toPath</c> if the paths are not related.</returns>
288- /// <exception cref="ArgumentNullException"></exception>
289- /// <exception cref="UriFormatException"></exception>
290- /// <exception cref="InvalidOperationException"></exception>
291- private string GetRelativePath ( string relativeTo , string path )
292- {
293- #if NETCOREAPP3_1 || NETCOREAPP3_0
294- return Path . GetRelativePath ( relativeTo , path ) ;
295- #else
296- if ( string . IsNullOrEmpty ( relativeTo ) )
297- throw new ArgumentNullException ( nameof ( relativeTo ) ) ;
298- if ( string . IsNullOrEmpty ( path ) )
299- throw new ArgumentNullException ( nameof ( path ) ) ;
300-
301- if ( relativeTo . Last ( ) != Path . DirectorySeparatorChar && relativeTo . Last ( ) != Path . AltDirectorySeparatorChar )
302- relativeTo += Path . DirectorySeparatorChar ;
303-
304- var fromUri = new Uri ( relativeTo ) ;
305- var toUri = new Uri ( path ) ;
306-
307- if ( fromUri . Scheme != toUri . Scheme )
308- return path ; // path can't be made relative.
309-
310- var relativeUri = fromUri . MakeRelativeUri ( toUri ) ;
311- var relativePath = Uri . UnescapeDataString ( relativeUri . ToString ( ) ) ;
312-
313- if ( toUri . Scheme . Equals ( "file" , StringComparison . OrdinalIgnoreCase ) )
314- {
315- relativePath = relativePath . Replace ( Path . AltDirectorySeparatorChar , Path . DirectorySeparatorChar ) ;
316- }
317-
318- return relativePath ;
319- #endif
320- }
321281 }
322282}
0 commit comments