mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
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)
|
private bool TryGetPlaylistItemPath(string itemPath, string playlistPath, List<string> libraryPaths, out string path)
|
||||||
{
|
{
|
||||||
path = null;
|
path = null;
|
||||||
var baseFolder = Path.GetDirectoryName(playlistPath);
|
string pathToCheck;
|
||||||
var basePath = Path.Combine(baseFolder, itemPath);
|
if (File.Exists(itemPath))
|
||||||
var fullPath = Path.GetFullPath(basePath);
|
{
|
||||||
|
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)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user