Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'remotes/origin/MP1-4495-BUG-Recordings_…
…in_Subfolders_failed_UNC_used_on_Multi-Seat'
  • Loading branch information
Sebastiii committed Jun 15, 2014
2 parents 03e2e75 + dce4f08 commit 745e6f4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions TvEngine3/TVLibrary/TvPlugin/TvPlugin/TVUtil.cs
Expand Up @@ -328,6 +328,31 @@ public static string GetFileNameForRecording(Recording rec)
string parentFolderName = dirInfo.Name;
fileName = TVHome.RecordingPath() + "\\" + parentFolderName + "\\" + fileName;
}

fileExists = File.Exists(fileName);

//check with foldername from set UNC Path
if (!fileExists)
{
//Get last foldername of RecordingPath
string parentFolderNameRecording =
Path.GetFileName(TVHome.RecordingPath().TrimEnd(Path.DirectorySeparatorChar));
parentFolderNameRecording = @"\" + parentFolderNameRecording.Replace(@"\", "\"\"") + @"\";
//Replace "\" with "" and add a "\" at the beginning and end (good for searching the path in the recording filename)

//Search the last folder of the set recording path in var rec.FileName
int iPos = rec.FileName.IndexOf(parentFolderNameRecording);
if (iPos != -1)
{
//We have found the last Folder of the set recording path in var rec.FileName

//Cut the first string (ussaly the TV Server Local Path) and remove the last Recording Folder from string
fileName = rec.FileName.Substring(iPos).Replace(parentFolderNameRecording, "");

//Add the recording path
fileName = TVHome.RecordingPath() + "\\" + fileName;
}
}
}
else
{
Expand Down

0 comments on commit 745e6f4

Please sign in to comment.