If itemPath exists, use that, otherwise try getting full path from relative path
This commit is contained in:
parent
2ca8ce6f60
commit
287e06d6dc
|
@ -158,15 +158,27 @@ namespace MediaBrowser.Providers.Playlists
|
|||
private bool TryGetPlaylistItemPath(string itemPath, string playlistPath, List<string> libraryPaths, out string path)
|
||||
{
|
||||
path = null;
|
||||
var baseFolder = Path.GetDirectoryName(playlistPath);
|
||||
var basePath = Path.Combine(baseFolder, itemPath);
|
||||
var fullPath = Path.GetFullPath(basePath);
|
||||
string pathToCheck;
|
||||
if (File.Exists(itemPath))
|
||||
{
|
||||
pathToCheck = itemPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
var baseFolder = Path.GetDirectoryName(playlistPath);
|
||||
var basePath = Path.Combine(baseFolder, itemPath);
|
||||
pathToCheck = Path.GetFullPath(basePath);
|
||||
if (!File.Exists(pathToCheck))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var libraryPath in libraryPaths)
|
||||
{
|
||||
if (fullPath.StartsWith(libraryPath, StringComparison.OrdinalIgnoreCase) && File.Exists(fullPath))
|
||||
if (pathToCheck.StartsWith(libraryPath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
path = fullPath;
|
||||
path = pathToCheck;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user