[gnome-subtitles] Make sure the video Uri is constructed properly (fixes crash opening the video when the application



commit cf79100e1eaef56e2d2b3c015bf575fd3e4e09a9
Author: Pedro Castro <mail pedrocastro org>
Date:   Sun Feb 16 03:18:22 2014 +0000

    Make sure the video Uri is constructed properly (fixes crash opening the video when the application is 
started with "gnome-subtitles ./path-to-file.srt")

 src/GnomeSubtitles/Ui/VideoPreview/VideoFiles.cs |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/GnomeSubtitles/Ui/VideoPreview/VideoFiles.cs 
b/src/GnomeSubtitles/Ui/VideoPreview/VideoFiles.cs
index 1d76eb4..9260bf1 100644
--- a/src/GnomeSubtitles/Ui/VideoPreview/VideoFiles.cs
+++ b/src/GnomeSubtitles/Ui/VideoPreview/VideoFiles.cs
@@ -44,13 +44,16 @@ public class VideoFiles {
        }
 
        public static Uri FindMatchingVideo (string file) {
-               ArrayList videoFiles = GetVideoFilesAtPath(Path.GetDirectoryName(file));
+               string fileDir = Path.GetDirectoryName(file);
+               ArrayList videoFiles = GetVideoFilesAtPath(fileDir);
                string filename = Path.GetFileNameWithoutExtension(file);
 
                foreach (string videoFile in videoFiles) {
                        string video = Path.GetFileNameWithoutExtension(videoFile);
-                       if (video == filename)
-                               return new Uri(videoFile);
+                       if (video == filename) {
+                               string videoFilename = Path.GetFileName(videoFile);
+                               return new Uri(Path.Combine(fileDir, videoFilename));
+                       }
                }
 
                return null;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]