aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-02-13 23:00:13 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-02-13 23:00:13 -0500
commita4b40ad9d90a40cd5e35bb7b9c43ad436e992cd4 (patch)
tree84a697bf606b293c3e74d7757b28d3bb40d1d269 /MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs
parent58a46171ababb816636a65aa7f76c00de50f598f (diff)
handle year in name when searching
Diffstat (limited to 'MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs')
-rw-r--r--MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs32
1 files changed, 31 insertions, 1 deletions
diff --git a/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs b/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs
index 3e02d96f6..98e81981d 100644
--- a/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs
+++ b/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Common.IO;
+using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.IO;
using MediaBrowser.Model.Logging;
using System;
using System.IO;
@@ -332,5 +333,34 @@ namespace MediaBrowser.Common.Implementations.IO
return path.TrimEnd(Path.DirectorySeparatorChar);
}
+
+ public string SubstitutePath(string path, string from, string to)
+ {
+ if (string.IsNullOrWhiteSpace(path))
+ {
+ throw new ArgumentNullException("path");
+ }
+ if (string.IsNullOrWhiteSpace(from))
+ {
+ throw new ArgumentNullException("from");
+ }
+ if (string.IsNullOrWhiteSpace(to))
+ {
+ throw new ArgumentNullException("to");
+ }
+
+ path = path.Replace(from, to, StringComparison.OrdinalIgnoreCase);
+
+ if (to.IndexOf('/') != -1)
+ {
+ path = path.Replace('\\', '/');
+ }
+ else
+ {
+ path = path.Replace('/', '\\');
+ }
+
+ return path;
+ }
}
}